Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.