Auto-open on page load... I'm stumped.

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Auto-open on page load... I'm stumped.

mikemcd
I've searched, I've tried to work the code into mine, etc., and it's just not working. I am trying to just get a swf file to play in Shadowbox, and for Shadowbox to automatically open on the HTML page. I just can't get it working. I can get a working Shadowbox with the swf file playing from a clicked link, but I need it to be automatic. Can someone provide a working example of this?

Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

Wizzud
Using jQuery...
<script type='text/javascript'>
$(function(){
  window.setTimeout(function(){
        Shadowbox.open({
            content: 'movie.swf'
          , player: 'swf'
          , width: 480
          , height: 320
          , title: 'Title'
          });
      }
    , 10);
});
</script>
For other libraries, use appropriate DOM Ready. Otherwise swap $(function(){ ... }); for window.onload = function(){ ... };.

[ With Shadowbox v3.0rc1, you can just supply the relevant link element to the open() call instead of the object. ]
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

mikemcd
It's just not working for me. Here's the code I have in the head of the page:

<link rel="stylesheet" type="text/css" href="shadowbox.css">
<script type="text/javascript" src="shadowbox.js"></script><script src="jquery.js" type="text/javascript"></script><script type="text/javascript"> $(function(){ window.setTimeout(function(){ Shadowbox.open({ content: 'images/xmascard_P1.swf' , player: 'swf' , width: 500 , height: 700 , title: 'Title' }); } , 10); }); </script>
What am I missing? Is there anything else I need to have here to get this to work?
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

Wizzud
Obvious question would be, Do you have jQuery?
Do you see any errors in Firebug's Console?
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

mikemcd
This post was updated on .
I downloaded jQuery and the js file is in my main directory, same one that the html and css files are in. I just downloaded Firebug and I do get an error. It says:

swfobject is not defined
anonymous()     shadowbox.js (line 1)
anonymous()     holiday09_test.html (line 21)

Not sure what that means...


Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

Wizzud
Before the $(function)...
Shadowbox.init({players:['swf']});
Combine literacy with curiosity and a whole world of information opens up to you
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

mikemcd

It works!

Thank you, Wizzud. I really appreciate your help!
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

mikemcd
Spoke too soon...

This seems to only work sometimes, with varying compatibility with different browsers. It's hit-or-miss on a Mac with either Safari or Firefox, and totally broken on Firefox in Windows Vista. In IE it is also sporadic. Sometimes it works, sometimes it doesn't.

Any ideas? Am I doing something wrong, or is this a Shadowbox issue?

Here's my page: http://www.updesign.com/holiday09.html

Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

CyberGolem
I checked this in both FF & IE and it seems to be working fine. Nice card btw.

Is your problem solved then?

-CG
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

CyberGolem
Uhhh, nm. I see what your solution was.

I'll give it a try myself.

:)
Reply | Threaded
Open this post in threaded view
|

Re: Auto-open on page load... I'm stumped.

UpGraphicDesign
Thanks guys I was looking for this info. for a while now.

Up Graphic Design