Display Floatbox window on page load

Page: 1

Author Post
Wasca
Guest
Hi Guys

I have a page with all my videos on it and I'd like to be able to create a url link that goes to that page and displays a float box based on the id tag I use in the url.

So if the link is http://mydomain.com/videos.html?id=1

when that link is clicked on, the videos.html page will open and then the element with id 1 will open, where id 1 is a floatbox window with a video in it.

So far i've tried to do this but to no avail

<script language='javascript'>
function dynamic_load() {
fb.start(document.getElementById('temp'));
}
dynamic_load();
</script>

temp is the id of the item I'm trying to load while testing this.

When I do this it keeps saying that fb is undefined, yet my float boxes work fine on the page.

Any help would be appreciated
Administrator
Registered: Aug 2008
Posts: 3382
You could use floatbox's autoStart capability to accomplish this.

Let's say you have an anchor on a page called 'somePage.html' that looks like this:
<a href="movies/myVid.swf" class="floatbox" rev="width:400 height:300 scrolling:no"></a>


A url something like http://mydomain.com/somePage.html?autoStart=myVid.swf will start that movie in floatbox when the page loads.

The more typical way of using autoStart is to place autoStart:true in the rev attribute options of the anchor you want to auto-start. But you talked about doing this through a url querystring and this is also supported in floatbox.

The reason why the script you quoted reports that fb is undefined is because fb is created after the page structure is in place (when the DOM is ready), but your inline code fires while the page is being assembled - that is, before floatbox's fb object exists.
Wasca
Guest
Hi All

Well I went away after doing a little reading on the forum and found the autostart option. After a little php magic on my page I can now call my video like so

http://mydomain.com/somePage.html?fbid=1

on my page i have this at the top

<?php 
if (isset($_GET["fbid"]))
$fbid = $_GET["fbid"];
?>


and then on each <a> link I have something like this on the floatbox options

data-fb-options="theme:black <?php if ($_GET["fbid"] == "1") echo "autoStart:true"; ?> group:quicktip width:652 height:391"


This seems to work just right for what I want.

Thanks for having the forsight to include an autostart option.

And for all those out there that have not purchased a license, get one. The developer deserves our support, oh and the support you get back is top notch!

Page: 1