Jump to content

stop propagation? How to use?


shortysbest

Recommended Posts

I am working on making a photo gallery and I want it to close when you click anything but the photo and other contents of the gallery, I can't figure out how to make this work though.

 

I have a function that should stop propagation for bot IE and everything else:

 

function stopagation(e)
{
    if (!e)
      e = window.event;

    if (e.cancelBubble)
      e.cancelBubble = true;
    else
      e.stopPropagation();
}

 

Then my script for closing the gallery would be:

 

$(".photo-gallery-wrapper").click(function(event){

stopagation(event);							   										   
$(".photo-gallery-wrapper").fadeOut("fast");					 


				 });

 

 

My gallery setup (just the very basic of it looks like:

 

<div class="photo-gallery-wrapper">
<div class="photo-gallery-container">
<img src="photos/<?php print $photo_id?>_440.jpg" />
</div>
</div>

Link to comment
https://forums.phpfreaks.com/topic/239344-stop-propagation-how-to-use/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.