colorbox icon indicating copy to clipboard operation
colorbox copied to clipboard

Disable click on image triggering next image?

Open andersHj opened this issue 10 years ago • 3 comments

Hi, I am trying to combine colorbox with wheelzoom. But I have not found a way to disable the click listener on the image. So if i try to zoom and den move the image around, it will switch to the next image instead of dragging the current.

Is it possible to disable the click listener on the image?

andersHj avatar Nov 24 '14 11:11 andersHj

There isn't an option to disable that, but you could use the onComplete (or cbox_complete event) to remove the onclick value. For example:

$('a.example').colorbox({onComplete: function(){
    $('.cboxPhoto')[0].onclick = null;
}});

jackmoore avatar Nov 24 '14 16:11 jackmoore

Thanks that works for me.

andersHj avatar Nov 24 '14 16:11 andersHj

@jackmoore thanks for pointing the right direction; I had to use onComplete: function(){ $('.cboxPhoto').unbind('click'); } the unbind wouldn't work in the document.ready otherwise and the .onclick=null wouldn't do anything

jrgd avatar Apr 05 '16 13:04 jrgd