I have a bunch of code for my plugin like this:
var element = $("*[data-label]");
(function ($) {
$.fn.Label = function (options) {
var label = $(this).attr("data-label"),
d = document.createElement('span'),
t = document.createTextNode(label),
config = $.extend({
display: 'inline',
position: 'absolute',
top: '6.5em',
padding: '0.5em',
backgroundColor: '#383838',
color: 'white',
fontSize: '0.8em',
opacity: '0.9',
}, options);
if (element.is(":hover")) {
d.className = "labelShow";
$(this).append(d);
$('.labelShow').append(t).css(config);
} else {
$(".labelShow").remove();
return false;
}
};
}(jQuery));
element.Label();
I have no errors in console, and debugger dont catch any events when I'm hovering element I'd like to respond to my widget code. Could you give me any hints why it doesn't work?