onLoad open Floatbox content

Page: 1

Author Post
Member
Registered: Feb 2013
Posts: 3
Hi all :)
I would like my page to launch a floatbox content automatically when the page itself loads.

The content is an external html.
Usually I do this using data-fb-options in a link

<a href="external.html" class="floatbox" data-fb-options="width:400 height:300">LINK TO CLICK</a>


but I would like to try that with an onLoad mode.

Any suggestions?
Administrator
Registered: Aug 2008
Posts: 3382
Off to the Instructions you go....

http://floatboxjs.com/instructions#auto

(hint: put autoStart:true or autoStart:once in your options)
Member
Registered: Feb 2013
Posts: 3
Thank you, I already looked at that ;) Anyway it's not very clear.

I'm working with the MM_openBrWindow script that I'm using in Dreamweaver.
Usually if I want a simple pop-up image to appear "onload", I add the code to the <body> tag

<body onload="MM_openBrWindow(&#039;example.html&#039;,&#039;mywindow&#039;,&#039;width=500,height=500&#039;)">
</body>


I tried to add the floatbox class to the previous code, but nothing happens.

<body onload="MM_openBrWindow(&#039;example.html&#039;,&#039;mywindow&#039;,&#039;width=500,height=500&#039;, class="floatbox" data-fb-options="width:500 height:500", "autoStart:true")">
</body>


Anyway, this is the original MM_openBrWindow script ...

<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
Administrator
Registered: Aug 2008
Posts: 3382
In your first post you quoted an html snippet of an <a> element that contains the 'floatbox' class and a data-fb-options attribute. Assuming that link is working fine when clicked, if you place autoStart:true in the data-fb-options attribute, the associated floatboxed item (external.html) will open at page load.

Like this:
<a href="external.html" class="floatbox" data-fb-options="autoStart:true width:400 height:300">LINK TO CLICK</a>
Member
Registered: Feb 2013
Posts: 3
Thank you!
This works. I was adding the autostart code in the wrong position, your suggestion now seems to go on ;)

Page: 1