1. When you view images on the page, you can rotate, zoom in, and zoom in the images.

Source: Internet
Author: User

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);    } }

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.