I have two images, each of which is wrapped in a link. I want to prevent a shot from the colorbox, if I have many years. I noticed that colorbox only works on mouseup.
I am trying to use the setTimeout function with a timer, and then delete the color images from this image and “re-connect” the color code to this image with the mouse so that it can be run again if setTimeout does not occur.
HTML:
<a class="colorbox" href="..."><img src="..." /></a> <a class="colorbox" href="..."><img src="..." /></a>
JS:
$('a.colorbox').colorbox(); var timer; $('a.colorbox').on('mousedown', function(e) { var this_colorbox = $(this); timer = setTimeout(function() { this_colorbox.colorbox.remove();
Here is the fiddle: http://jsfiddle.net/mydCn/
I have a problem: $ .colorbox.remove (); (or my attempt at this_colorbox.colorbox.remove ();) removes the colorbox from all elements. How can I “reconnect the colorbox” to this image instead of calling the function again for each element (if so, when the number of images will affect performance, no?)?
source share