Thanks again, I understand what's happening now and I've been able to correct my code. The plugin I'm working on is functioning perfectly - I no longer need to filter out results or toggle classes.
On Feb 21, 4:20 pm, Nikola <nik.cod...@gmail.com> wrote: > Ohhhhh.... > > Thank you! I've tried so many different things, like defining _this > after the event but I never thought of writing it this way. Thanks > much, this explains it. > > On Feb 21, 4:18 pm, 浩翔 <blackange...@gmail.com> wrote: > > > sorry for my poor english, i hope you can understand my mean. > > > On Feb 22, 5:12 am, Alex <blackange...@gmail.com> wrote: > > > > $(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