JavaScript implementation of album window function (zepto.js) _javascript skills

Source: Internet
Author: User

First look at the window effect, as follows:

Enlarge the picture $ (page). On (' click ', '. Popupimage img ', function () {var-= $ (this);

  That.popupimage ({this:that, Width: "200px"})});
  Album Pinball Window $.fn.popupimage = function (obj) {var $this = obj.this;
  var sj_w = $this [0].naturalheight;
  var src = $this. attr (' src ');
  var h = $ (' body '). Height ();
  var w = $ (' body '). width ();
  var padding = 10;
  var shadew = w-padding*2;
  
  var img = ', shade = '; img = ' <div class= ' popup-image ' style= ' position:absolute; top:0; left:0; z-index:999999; padding:10px ' +padding+ ' px; Width: ' +w+ ' px; Height: ' +h+ ' px; Line-height: ' +h+ ' px;
  Text-align:center "> ' + ' </div> '; Shade = ' <div class= ' shade ' style= ' position:absolute; top:0; left:0; Width: ' +w+ ' px; Height: ' +h+ ' px;background: #000; z-index:999990; Opacity:. 8; "

  ></div> ';
  $ (' body '). Append (shade);  

  $ (' body '). Append (IMG); $ ('. Popup-image '). On (' click ', Function () {$ ('. Popup-imagE '). Remove ();
  $ ('. Shade '). Remove ();
 })

 };

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

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.