1. When you view images on the page, you can rotate, zoom in, and zoom in the images.
1. view the image (always vertically centered)
1 // view image 2 $ (document ). on ('click', '# ckgzs', function () {3 var id = $ ("# fhzx_lsh "). val (); 4 $. ajax ({5 type: 'post', 6 url: basePath + 'common _ getGzsZm. do ', 7 data: {lsh: id}, 8 dataType: 'text', 9 success: function (data) {10 var window_h = $ (window ). height (); 11 if (data = '1') {12 parent. layer. open ({13 type: title: false, // do not display title 15 // title: ['xxx', 'font-size: 18px; '], 16 skin: 'layui-layer-rim ', // Add the border 17 area: ['000000', '000000'], // width and height 18 // anim: 4, // animation type 19 content: '<div> 20 // content: '<div> 21}); 22} else {23 parent. swal ("no proof file! "); 24 return; 25} 26} 27}); 28 });
2. Control image rotation
// Control the image rotation var current = 0; // The current image angle function tranImg (trun) {// obtain the target image node var imgobj?#parent.doc ument by id. getElementById ('currentimg '); if (! ImgObj) {imgobj?##parent.parent.doc ument. getElementById ('currentimg '); if (! ImgObj) {imgObj = document. getElementById ('currentimg ');} current = (current + trun) % 360; if (current = 90 | current =-90 | current = 270 | current =-270) {var window_h = $ (window ). height (); $ ("# currentImg" ).css ("max-width", window_h); imgObj. style. transform = 'translate (-50%,-50%) rotate ('+ current + 'deg)';} else {$ ("# currentImg" ).css ("max-width ", & quot; 100% & quot;); imgObj. style. transform = 'translate (-50%,-50%) rotate ('+ current + 'deg)';} // imgObj. style. transform = 'rotate ('+ current + 'deg )';}
3. Control Image zoom-in and zoom-out
function fangda_img(fdorsx){ if (ForX=="fd") { $("#currentImg").width($("#currentImg").width()*1.1); $("#currentImg").height($("#currentImg").height()*1.1); }else if(ForX=="sx"){ $("#currentImg").width($("#currentImg").width()/1.1); $("#currentImg").height($("#currentImg").height()/1.1); } }