Disable Lightbox on Small Screens
  • Hey guys,

    I need your help to disable the prettyphoto lightbox if the width of the window is smaller than 768px.

    With this code when the window is smaller I can disable the lightbox, but when I make it bigger I don’t know how to make the lightbox work again.

    $(window).resize(function () {
    if ( $(window).width() <= 767 ) {<br /> $('a[rel^="lightbox"]').unbind('click').on('click', function (event) {
    event.preventDefault();
    });
    } else {
    $('a[rel^="lightbox"]').bind('click');
    }
    });


    Thanks
  • Lets try with:


    $('a[rel^="prettyPhoto"]').unbind('click.prettyphoto');

    and

    $('a[rel^="prettyPhoto"]').bind('click.prettyphoto',$.prettyPhoto.initialize);

    That works for me.
    The plugin jquery.prettyPhoto.js use 'click.prettyphoto' event instead of just 'click'.

    $.prettyPhoto.initialize reinitialze the original/previous settings.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter