0

Disable PrettyPhoto on mobile phones

Disable PrettyPhoto on mobile phones

prettyphoto is the jquery light box plugin which is used to show any image or content in the popup. In Desktop view these popup look good but in mobile layout it not look good so i have disabled it. follow the following steps to disable the preetyphoto on mobile devices.

Open up jquery.prettyPhoto.js
Find the following codes
<pre>
jQuery(document).ready(function(){
jQuery(“a[data-gal^=’prettyPhoto’]”).prettyPhoto({social_tools: false});
});

</pre>

and replace with the following codes.
<pre>
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};

jQuery(document).ready(function(){
if( !isMobile.any()){
jQuery(“a[data-gal^=’prettyPhoto’]”).prettyPhoto({social_tools: false});
}
});

</pre>

Sandeep Kumar

Sandeep kumar is a web developer and a professinal blogger. He works for latest technologies and write articles what he learn. In ICodeHub he share web languages tutorials and other programming tips and tricks. if you need some help or have some suggestion then mail him at sandeep92pal@gmail.com without any hesitation. He believes in learning and sharing.