Hi All,
I have a customer wanting to display images of their artwork, however they requested that right click and drag and drop to be disable on all images within their galleries.
I have successfully managed most of the request by updating the theme to include:
function nocontext(e)
{
var clickedTag = (e==null) ? event.srcElement.tagName : e.target.tagName;
if (clickedTag == "IMG")
{
//alert(alertMsg);
return false;
}
}
//var alertMsg = "Image context menu is disabled";
document.oncontextmenu = nocontext; //]]>
window.onload = function (e)
{
var evt = e || window.event,// define event (cross browser)
imgs, // images collection
i; // used in local loop
if (evt.preventDefault)
{
imgs = document.getElementsByTagName('img');
for (i = 0; i < imgs.length; i++)
{
imgs[i].onmousedown = disableDragging;
}
}
};
function disableDragging(e)
{
e.preventDefault();
}
The above javascript/jquery is load as part of the header of the theme, however the above works fine for the exception of images displayed within Colorbox and Slideshows where images are still dragable.
So my enquiry is how can I stop these image presented in Colorbox and the Colorbox Sideshow from being dragged?