سؤال

I'm trying to make a simple call to a popup jquery plugin (bpopup).

;(function($) {
    $(window).load(function(){
        $('#popup').bPopup({
            modalClose: false,
            opacity: 0.6,
            positionStyle: 'fixed'
        });
    });
});
})(jQuery);

There is a div with the id 'popup' which should appear, however nothing is happening (no popup is even being blocked) when the window loads.

Any advice greatly appreciated, thank you.

EDIT: The page in question is very light - text only, the popup only contains text.

هل كانت مفيدة؟

المحلول

You have a syntax error in your code. Remove one of the extra });.

;(function($) {
    $(window).load(function(){
        $('#popup').bPopup({
            modalClose: false,
            opacity: 0.6,
            positionStyle: 'fixed'
        });
    });
})(jQuery);

نصائح أخرى

Try this , changed to use $(document).ready

  ;(function($) {
  $(document).ready(function(){
                $('#popup').bPopup({
            modalClose: false,
            opacity: 0.6,
            positionStyle: 'fixed'
                });
            });
        });
    })(jQuery);

window onload will wait for all the assets to be loaded so it is possible that you are loading something that takes long time

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top