Good day! Please tell me how to check for initialization of the jPages plugin. It is necessary that in the mobile version it was called, and with the tablet, desktop, if it was called earlier, it was destroyed. If not called, it is called. Thanks a lot in advance!

$(window).bind("load resize", function() { var windowWidth = screen.width; if(windowWidth < 768){ $("div.catalog_holder").jPages({ containerID : "itemContainer", fallback : 500, perPage : 1, midRange : 4 }); }else if(...){ $("div.catalog_holder").jPages("destroy"); } }); 

    1 answer 1

    I did not work with this plugin, but I would do your function like this:

     $(window).resize(function() { JPages(); }); JPages(); function JPages() { if ($(window).width() < 768) { $("div.catalog_holder").jPages({ containerID: "itemContainer", fallback: 500, perPage: 1, midRange: 4 }); } else { $("div.catalog_holder").jPages("destroy"); } } 

    It will work and when loading and resize. + there is a function .unbind () , which you can cancel inits. functions.

    • Thank you so much for the help !!) You helped me very much) - alexandra