Ahsan Habib
Ahsan Habib

Reputation: 167

Disable image zoom in mobile

I use an image zoom and it's working on desktop well. I want to make it false in mobile. Here is the link http://emoncmt2.byethost15.com/jul/shop-details.html Is it possible to make it false when the width is less than 768px?

I use those code to active it.

$(document).ready(function() {
                /* simple call */

                $('.myzoom').jqzoom({
            zoomType: 'standard',
            lens:true,
            preloadImages: false,
            alwaysOn:false,
            zoomWidth: 600,  
            zoomHeight: 420,
            position:'right' 
        });
        });

Upvotes: 0

Views: 1300

Answers (1)

Ivan Minakov
Ivan Minakov

Reputation: 1442

You should detect mobile device and wrap initialization code into condition:

   $(document).ready(function() {   
     if( !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
         $('.myzoom').jqzoom({
                    zoomType: 'standard',
                    lens:true,
                    preloadImages: false,
                    alwaysOn:false,
                    zoomWidth: 600,  
                    zoomHeight: 420,
                    position:'right' 
                });
        }
    }

Upvotes: 1

Related Questions