Tuesday 5 February 2008

auto open MultiBox onDomReady

I've had this request a few times now, so i thought i'll post the code.

It's very simple. Just call the open function and pass the element in:

var box = {};
window.addEvent('domready', function(){
box = new MultiBox('mb', {descClassName: 'multiBoxDesc'});
box.open($('mb1'));
});

18 comments:

Anonymous said...

do you have a sample of onOpen / onClose ?

thank you.

Sham Kamarul said...

how do i position it close the clicked element? or maybe to center it to the screen

vosorio said...

hello, i need to use this auto open but whehn i use an FLV file it's not working... what could it be happening ?
i used the code you show as example

thanks

vosorio said...

i found the error, you need the folder "files" with all the swf that was my error.

Sham Kamarul said...

oh well...but then how do i position the box popup to the center of the screen?

Philip Thrasher said...

Is there a way to get your rounded corners js to work on multibox?

Anonymous said...

Hello!
And how to make Lightbox auto open?

Regards,
Igor

Anonymous said...

Hi Sam,

I would be glad to have a sample on how to use the OnClose and OnOpen parameters because when I register f.e. an alert('onpost') as a function to call as an OnClose function the alert appers when the page is beeing loaded. It seemed like I had written <BODY OnLOAD=alert('OnClose')> in my HTML-Page and that is not what I think it should work like.

The background is that I would like to put a form for editing f.e. the name of a user in a multibox-dialogue. After updating the data I would like to call an xajax function to update my website content to show the new name. Therefore I thought OnClose would be the tool I needed.

But however thanks a lot so far for the great component.

Regards,
Rico

Developpeuse said...

Great plugin, but is it possible to have 2 galleries on the same page, and switch from one to another?
Example: in the first gallery, there would be a button to close the #1st and open the # 2nd..? Someone would have an idea please?
Thanks for the post and thank you in advance for the answer,
Aurélie

Anonymous said...

Please,
Im stuck with this one...
I just want to open Multibox when page loads.
Inside MB is flash, how to achive this?!
Should i put it inside DIV, or put swf inside page with some class?

And why is in this code 'mb', and the you are opening 'mb1'?
Im not so well with JS, so im bit confused...

I tried everything, but i cant open it on load?

Please & Thanks in advance

Anonymous said...

I love multibox, but I can't figure out how to implement this, to make it auto open. Can anyone provide more help, or a link to a page where it's set up and functioning?

Anonymous said...

Hi Samual,
I love your Way of Lightbox and use it in many projects.

But is it possible that your posted code here doesn't work correctly in IE7? In Firefox the automatic opening on page load is working perfect, but in IE7 I can only see the overlay (more transparent than on the "normal" opening via hyperlink) without the box on top of it.

I hope you answer here in your blog, because your forum is down.

Anonymous said...

hi,
i need to know how to close the multibox using custom button or link??

does any one knows.

Anonymous said...

Can anybody of you tell me, how I can close the box after 5 seconds? (maybe in a function which is called by onOpen)

Thanks a lot

Anonymous said...

Hi!
I´ve posted the previous message and I´ve already fixed the problem:
var box2 ={};
window.addEvent('domready', function(){box2 = new MultiBox('mb', {descClassName: 'multiBoxDesc', useOverlay: true});
box2.open($('mb1'));window.setTimeout(function(){box2.close()},'5000'); });

Sildenafil Citrate said...

I was looking for this code for a special personal project I am working on and I need the code to use it as a basic code for my project, thank you for sharing!

alterity said...

I hope someone is still reading this topic.

I need something slightly different and I am at my wit's end trying to figure it out.

What I need to do is pause or delay the opening of the box, so the box waits about 15 seconds before opening.

Any ideas...?

azithromycin zithromax said...

I would be glad to have a sample on how to use the OnClose and OnOpen parameters because when I register f.e. an alert('onpost') as a function to call as an OnClose function the alert appers when the page is beeing loaded.