12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <link rel="stylesheet" href="{{theme_asset('statistics/js/layer/skin/default/layer.css')}}?t=1">
- <style>
- body {background:white;}
- img {margin:0;padding:0;border:none;display:block;width:100%;}
- </style>
- <script src="{{ theme_asset('jquery/jquery.min.js') }}"></script>
- <script src="{{ theme_asset('statistics/js/layer/layer.js') }}"></script>
- {{--<img src="{{$src}}" class="img">--}}
- <script>
- //获取图片原始高度
- var img_url = '{{$src}}';
- var img = new Image();
- img.src = img_url;
- var img_width = 0;
- img.onload = function(){
- img_width = img.width;
- };
- //图片旋转
- var num = 0;
- function transform(){
- num = (num + 90) % 360;
- $("#layui-layer-photos").css('transform', 'rotate(' + num + 'deg)');
- }
- //图片缩放
- var flag = false;
- function zoom()
- {
- flag = !flag;
- if (flag) {
- $('.img').css('width',img_width+'px');
- } else {
- $('.img').css('width','100%');
- }
- }
- layer.photos({
- photos: {!!json_encode($photos)!!}
- });
- $(document).on("mousewheel DOMMouseScroll", ".layui-layer-phimg img", function (e) {
- var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) || // chrome & ie
- (e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1)); // firefox
- var imagep = $(".layui-layer-phimg").parent().parent();
- var image = $(".layui-layer-phimg").parent();
- var h = image.height();
- var w = image.width();
- if (delta > 0) {
- h = h * 1.05;
- w = w * 1.05;
- } else if (delta < 0) {
- if (h > 100) {
- h = h * 0.95;
- w = w * 0.95;
- }
- }
- imagep.css("top", (window.innerHeight - h) / 2);
- imagep.css("left", (window.innerWidth - w) / 2);
- image.height(h);
- image.width(w);
- imagep.height(h);
- imagep.width(w);
- });
- </script>
|