Prevent some click event

19 views
Skip to first unread message

Tazintosh

unread,
May 7, 2013, 7:02:24 AM5/7/13
to cer...@googlegroups.com
Hi folks,

I'm a long date user of Cerabox and we're both folllowing each other ;-)
Today, I'm facing a special behavior I would like to handle on the client website.

• The site is layout as like multiple big rows.
• By clicking a single row (anywhere on it), this will fire an action that will open it and reveal it's content.
• If I click back this row (again anywhere), this will close and hide the content.

• My content contains a Cerabox gallery (Yeah, I think you probably already get it…)
--> If I click a thumb, this will open the cerabox full size image… but also close my row…

Is there any way to avoid my click to also fire on the parent element?

Thanks for your help.
Édouard.

Cera media

unread,
May 7, 2013, 7:12:37 AM5/7/13
to cer...@googlegroups.com
Hi Édouard,

Sure there is, this is actually basic javascript event handeling. You can stop events from bubbling to its parents by stopping propagation.

Something like this should do the trick (not tested):

$$('a.ceraboxLinks').addEvent('click',function(event){
    event.stopPropagation();
});

You can also share us some code if you can't get it to work, we're happy to help.

Cheers

Op dinsdag 7 mei 2013 13:02:24 UTC+2 schreef Tazintosh het volgende:

Tazintosh

unread,
May 7, 2013, 7:18:47 AM5/7/13
to cer...@googlegroups.com
That made the trick!
Excellent, thank you, once again!
Reply all
Reply to author
Forward
0 new messages