Mobile-click the image to view full screen

Source: Internet
Author: User

After submitting the service demand ticket in the public number, after the stages of "waiting to be Assigned", "Pending", "executing" and "Waiting for acceptance", it is necessary for the acceptance person to submit a comment to upload the image to become "completed".

After doing a new click on the picture full-screen view of the needs, just started to use the method can do, but due to the version of jquery conflict, so had to change the current method.

<Divclass= "Add_photo"style= "margin-top:1000px;">        <ul>            <Liclass= "Li_images">                <imgsrc= "Images/hd-img.jpg"class= "Item_img">            </Li>            <Liclass= "Li_images">                <imgsrc= "Images/2.jpg"class= "Item_img">            </Li>        </ul></Div>

The specific style will not be written, the effect if:

At the beginning of the time did not consider too much, just simple to write a preview of the location of the image, FTP upload in the phone after the test, preview the effect of the picture came out, but, as shown, the test page did not scroll, so there is no awareness of the problem,

(1) I write the preview background of the hieght is 100%, so the preview when the height of the gray preview background is the entire page, that is, the mobile phone side of the visual window height + scrolling height. So it was modified: height should be the visible window height, and the top value of the preview background should be the height of the page scrolling, while the top value of the preview picture should be the height of the page scrolling + One-fourth of the visible height.

(2) The full-screen preview should not be able to swipe up and down, but the phone page has scrolling so that you can swipe up and down, so you should click on the target Image preview to let the scrolling fail, after the preview to recover the scroll event.

The final changes are as follows:::

<script type= "Text/javascript" >$.fn. Imgzoomin=function () {            varWindow_h =$ (window). Height (); varScroll_h =$ (window). scrolltop (); Bgstr= ' <div id= ' imgzoominbg "style=" Position:absolute;filter:alpha (opacity=70); Opacity:0.7;z-index:10000;background-color: #000;d isplay:none; " ></div> '; Imgstr= '  This). attr (' src ') + ' "style=" cursor:pointer; Display:none; Position:absolute; z-index:10001; "/>"; if($ (' #ImgZoomInBG '). Length < 1) {                $(' Body '). Append (BGSTR); }            if($ (' #ImgZoomInImage '). Length < 1) {                $(' Body '). Append (IMGSTR); }            Else {                $(' #ImgZoomInImage '). attr (' src ', $ ( This). attr (' src ')); }            $(' #ImgZoomInBG '). CSS (' top ', scroll_h+ ' px ')); $(' #ImgZoomInBG '). CSS (' width ', ' 100% ')); $(' #ImgZoomInBG '). CSS (' height ', window_h+ ' px ')); $(' #ImgZoomInImage '). CSS (' width ', ' 100% ')); $(' #ImgZoomInImage '). CSS (' height ', (WINDOW_H/2) + ' px '); $ (' #ImgZoomInImage '). CSS (' top ', (SCROLL_H+WINDOW_H/4) + ' px ');            $(' #ImgZoomInBG '). Show (); $(' #ImgZoomInImage '). Show (); };//PC-Side$ (document). Ready (function() {$ (document). On (' Click ', '. Item_img ',function (){                $( This).                Imgzoomin (); $ (document.body). css ({"Overflow-x": "Hidden",                    "Overflow-y": "Hidden"                });            }); $ (document). On (' Click ', ' #ImgZoomInImage ',function(){                $(' #ImgZoomInImage '). Hide (); $(' #ImgZoomInBG '). Hide (); $ (document.body). css ({"Overflow-x": "Auto",                    "Overflow-y": "Auto"                });        }); });//mobile phone side$ (document). Ready (function() {$ (document). On (' Touchend ', '. Item_img ',function(t) {$ ( This).                Imgzoomin (); Document.ontouchstart=function(){                    return false;            } t.preventdefault ();            }); $ (document). On (' Touchend ', ' #ImgZoomInImage ',function(t) {$ (' #ImgZoomInImage '). Hide (); $(' #ImgZoomInBG '). Hide (); Document.ontouchstart=function(){                    return true;            } t.preventdefault ();        });    }); </script>

The effect of mobile phone is as follows:

Mobile-click the image to view full screen

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.