I have created a jsfiddle here http://jsfiddle.net/xfc7H/. here when I hover the mouse on the text resize
it flickers. So that means the event is being propagated. I want this text to appear stable when I hover on it. Please if someone can resolve the issue.
the html
<div class="jqte_editor" >
<img width=100px height=100px stye=" border:1px solid #eee;" src='http://appendto.com/wp-content/uploads/2013/04/training-hero.jpg'></img>
</div>
the jquery
$('.jqte_editor').on('mousedown', 'span', function() {
$("#imagecontainer").has(this).prepend("<div style='font-size:10px; position:absolute; background-color:#eee; opacity:1; width:70px; top:" + $(this).position().top + "; left:" + $(this).position().left + ";' id='imageresizer'>Width:<input type='text' style='width:25px; opacity:1.0;' id='imagewidth'></input><br> height:<input type='text' id='imageheight' style='width:25px'></input></div>");
return false;
});
$('.jqte_editor').on('mouseenter', 'span', function(e) {
e.stopPropagation();
});
$('.jqte_editor').on('mouseenter', 'img', function() {
$(this).wrap("<div id='imagecontainer' style='float:left; position:relative;'></div>");
$("#imagecontainer").prepend("<span style='position:absolute; top:0px; left:0px; background-color:#eee; color:#888;' id='spanresize'>resize</span>");
});
$('.jqte_editor').on('mouseleave', 'img', function() {
$("#spanresize").remove();
$("#imagecontainer> img").unwrap();
});
$('.jqte_editor').on('mousedown', 'img', function() { $("#spanresizer").remove(); $("#imageresizer").remove(); $("#imagecontainer> img").unwrap(); });
$('.jqte_editor').on('keyup', 'input', function() {
var imagelement = $("#imagecontainer").find('img');
console.log(imagelement);
var width = $("#imagewidth").val();
var height = $("#imageheight").val();
console.log(width);
imagelement.attr("width", width);
imagelement.attr("height", height);
});