Click image to enlarge to original image size

Source: Internet
Author: User

Sometimes in order to tidy up the layout, the page display of the picture must be limited to a wide, if you want to click on the image to enlarge to the original size of the preview, again click Back to the original appearance, you need to use the following code:

Var _w = parseint ($ (window). width ());//Gets the breadth of the browser $ ("#abc  img"). each (function (i) {     var img = this;    var realwidth;//true Width      var realheight;//true Height     $ ("=_w) {                 $ (IMG). CSS ({                      "width":  "100%",                      "Height" :  "Auto",                      "position":  "fixed",                      "Top":  "50%",                      "left":  "50%",                       "Margin-top":  " -30%",                      "Margin-left":  " -50%"                  });             }else{                $ ( IMG). CSS ({                      "width": realwidth,                      "Height": realheight,                      "position":   "Fixed",                      "Top":  "50%",                      "left":  "50%",                      "Margin-top":  -realheight / 2,                       "Margin-left": -realwidth / 2                 });             }            flag = 0;         } else {             $ (IMG). CSS ({                  "width": 500,                  "Height": 400,             });             flag = 1;      (   }    });});

The above code to obtain the original width of the picture is reproduced, after processing as above. Pro-Test effective, but for the image upload, after the click Method, seemingly do not get to the original width, I think it should be the reason of load, but also understand the big God more guidance, how to achieve the uploaded picture file, click the thumbnail, zoom to the original size!!!


This article is from the "Small Syria frontend" blog, please be sure to keep this source http://beileixinqing.blog.51cto.com/7540036/1881158

Click image to enlarge to original image size

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.