function initDrag(event)
{
var lastOffset = context.getElementTranslation(element);
// Get initial coordinates for (x,y)
initialX = event.pageX;
initialY = event.pageY;
// Determine last offset points for (x,y)
lastOffsetX = lastOffset ? lastOffset[0] : 0;
lastOffsetY = lastOffset ? lastOffset[1] : 0;
startOffsetX = initialX - lastOffsetX;
startOffsetY = initialY - lastOffsetY;
event.stopPropagation();
event.preventDefault();
elem.className = elem.className + ' draggable';
document.documentElement.addEventListener('mousemove', doDrag, false);
document.documentElement.addEventListener('mouseup', stopDrag, false);
}
jQuery('.classname').on('click', function(event)
{
alert(23);
jQuery('.medium-editor-button-first').attr('style','');
if(!event.shiftKey)
{
if(layer.hasClass('layer_selected'))
{
event.stopPropagation();
return false;
}
context.deselectAllLayers();
context.setLayerSelected(layerId);
}
else
{
/*if(jQuery('.layer_selected').length < 1 )
{
context.deselectAllLayers();
}*/
if(layer.hasClass('layer_selected'))
{
layer.removeClass('layer_selected multiSelectLayers');
context.initializeMultiSelect(layer);
event.stopPropagation();
return false;
}
context.selectors.multiSelect.removeClass('layer_selected');
}
layer.find('.tp-caption').focus();
layer.addClass("layer_selected");
context.initializeMultiSelect(layerId);
event.stopPropagation();
});
每次鼠标单击后点击功能开火。我想阻止此点击事件。我尝试了 event.stopPropagation(); 和 event.preventDefault(); 但是没有用。
提前致谢。