1$ ("img"). Click (function () {
//Get window visual size 2var width=$ (window). width ();3var height=$ (window). Height ();4var img=$ ( This);5var html= '; //Get the picture's true width and height
6$ (") ). Load (function () {7Realwidth = This. Width;8Realheight = This. Height;9 //If the true width is greater than the width of the browser, it is displayed as 100%Ten if(realwidth>=width) { One //$ (IMG). CSS ("width", "100%"). CSS ("height", "Auto"); AWidth= "100%"; -height= "Auto"; - } the Else{//If the width is smaller than the browser, it is displayed in the original size - //$ (IMG). CSS ("width", realwidth+ ' px '). CSS ("height", realheight+ ' px '); -Width=Realwidth; -height=Realheight; + } -Html= ' This). attr ("src") + ' style= ' width: ' +width+ ' "/> '; //Borrow the layer.mobile popup plugin here
+var pagei =Layer.open ({ AType:1, at content:html, - //style: ' position:fixed; left:0; top:0; width:100%; height:100%; border:none; ' - }); - }); - -});
JS Mobile Image Pop-up method