Open a Cerabox through Javascript

212 views
Skip to first unread message

Mario

unread,
Jun 12, 2011, 1:32:31 PM6/12/11
to CeraBox
Hi,

I need to open a Cerabox Window through Javascript, what would be the
proper Syntax for it?

Ceramedia

unread,
Jun 13, 2011, 9:58:56 AM6/13/11
to CeraBox
Hi Mario,

The best way to do that would be to fire the elements click event.
Here is an example of one way to do it;

box.addItems('#example1 a', {
animation: 'ease',
loaderAtItem: true
});
// Open the CeraBox with the first item in collection
$('example1').getElement('a:first-child').fireEvent('click');

Hope this helps if you have anymore questions, I will be happy to
answer them.

Cheers

Mario

unread,
Jun 13, 2011, 10:03:26 AM6/13/11
to CeraBox
Thank you,

but I need to open the Cerabox out of a Flash File.

Example which is used with Lightwindow:
javascript: myLightWindow.activateWindow({href: `your url`,
widht:'500', height:'500', title:'Your Title'})

Mario

Ceramedia

unread,
Jun 13, 2011, 10:36:26 AM6/13/11
to CeraBox
CeraBox only works with anchor tags, so there should be real tags
there that hold the information.

What you could do in your situation is make an anchor element that is
added to the CerBox, example;

<a href="http://google.com" id="flash-use-me" title="Google"
style="display:none"></a>

<script>box.addItems('#flash-use-me');</script>

Then make a function that flash can execute and pass arguments to so
you can edit the anchor for different results. Also the box.addItems
method detects which type of content it will be, so if you are gonna
pass image links your anchor href should end with an image type like
".jpg". So instead of http://google.com it should be something like
http://blabla.com/.jpg. I don't think it has to be a valid URL as it
will not be loaded until requested.

flashCallMe(href) {
$('flash-use-me').set('href',href).fireEvent('click');
}

I haven't tested this code and don't think it is a very clean way.
CeraBox is not really mend to be used in this way. I will throw this
in the group and see if we can make it more dynamic in the future.
Message has been deleted

Kevin La

unread,
Jul 4, 2013, 2:07:29 PM7/4/13
to cer...@googlegroups.com
Hi Cera media,

Can you explain line by line how this works? I'm trying to implement something similar where the cerabox opens on page load to play a YouTube video. Any help is appreciated. I know this thread is old but it's the only info I could find on this topic. Much thanks.
Reply all
Reply to author
Forward
0 new messages