$(this) is no problem.

hover_in() and hover_out() should place in each method.

if hover_in() and hover_out() placed outside each method, $this in hover_in() and hover_out() is all li tag.


are u understand ?

you should write like this :

=====================================

$.fn.simpleFunction = function(options) {

var options = jQuery.extend( {colorOne:'#660066', colorTwo:'#808080'},options);



        this.each(function() {
          var $this = $(this);

function hover_in() { $this.css({backgroundColor:options.colorOne}); }; function hover_out() { $this.css({backgroundColor:options.colorTwo}); };

            $(this).hover(function () {
                hover_in();
                },function(){
                hover_out();
            });
        });

        return this;
};
    $(".hover_me").simpleFunction();


});


=======================================










On 2009-2-22, at 上午3:06, Nikola wrote:


Hello,

I've written a simple function for a hover event but I can't seem to
specify what $(this) is properly.  Here's a little example I put
together, any input would be great.

Thanks..

http://jsbin.com/ezeye/edit

Reply via email to