Need help in creating a basic plugin
Hello every body i want to create a basic plugin in which whenever mouse is hovered over an image its opacity will change but the problem i'm facing is that i'm not able to add mouseover effect in my plugin...
The plugin is shown below
- (function($)
{
$.fn.imageHoverOverText = function(options)
{
var defaults =
{
"width": 200,
"height": 50
}
var parameters = $.extend(defaults,options);
return this.each(function(){
var element = $(this);
element.mouseover(function(){
$(this).css('opacity','0.2');
});
});
};
}
(jQuery));
and the evoking jquery is
$(document).ready(function(){ $('img').imageHoverOverText({width: 200, height: 50});
html code is shown below...
<img src="images/.jpg" alt="green snake" />