Shadowbox 3.0.3

I am trying to use shadowbox 3.0.3 in google chrome

I get:

in chrome

shadowbox.js: 17 Uncaught TypeError: Cannot read the 'style' property from undefined

in firefox

F undefined g.find = (function () {var aD = / ((?: ((?: (... ()}}; g.skin = k; T.Shadowbox = g}) (window); shadowbox .js (line 17)

seems to work fine in IE

My code is below:

<!doctype html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script> <script src="shadowbox.js"></script> <link href="shadowbox.css" rel="stylesheet"/> <script> $(function() { Shadowbox.init({skipSetup: true}); // open a welcome message as soon as the window loads Shadowbox.open({ content: '<div id="welcome-msg">Welcome to my website!</div>', player: "html", title: "Welcome", height: 350, width: 350 }); }) </script> </head> <body> </body> </html> 

what would it cause?

+4
source share
2 answers

Use the window.load method as suggested in docs :

 <script type="text/javascript"> Shadowbox.init({ skipSetup: true }); $(window).load(function() { // open a welcome message as soon as the window loads Shadowbox.open({ content: '<div id="welcome-msg">Welcome to my website!</div>', player: "html", title: "Welcome", height: 350, width: 350 }); }); </script> 
+8
source

This is just an assumption, but perhaps Shadowbox.init () should go beyond $ (function () ...) so that it is called before the window loads. Here is what the example offers on its website: http://www.shadowbox-js.com/usage.html

+1
source

Source: https://habr.com/ru/post/1337890/


All Articles