> Inside the plugin method "this" is already a jQuery object, thus you
> And you usually shouldn't forget to maintain chainability by returning
> the object:
Thanks for reminding, I keep forgetting about these basic jQuery
principles - after all, that's what jQuery is about...
Grüße in die Sred
Bernd Matzner wrote:
Hi Eridius,
yes, "this" refers to the object passed to the plugin, in your case
$('#hover_menu').hover_menu();
which would be shorter than
$('div[id=hover_menu]').hover_menu()
(function($)
{
$.fn.hover_menu = function(){
$(this).children('ul').children('li')
On 8/14/07, Karl Swedberg <[EMAIL PROTECTED]> wrote:
>
>
> On Aug 13, 2007, at 7:35 PM, Joel Birch wrote:
>
> Also, to get all the li elements within the initial object, I used find()
> instead of children(). I'm a bit foggy on what the difference is at the
> moment, but find works me.
>
> The diff
On Aug 13, 2007, at 7:35 PM, Joel Birch wrote:
Personally, I'd use:
jQuery.fn.hover_menu = function(offset, speed){
this.find('').each(function(){ // 'this' is already a jQuery
object (the one you attach the plugin to)
var current_margin = $(this).css('marginLeft'); // 'this'
ne
On 8/14/07, Joel Birch <[EMAIL PROTECTED]> wrote:
>
> jQuery.fn.hover_menu = function(offset, speed){
>this.find('').each(function(){ // 'this' is already a jQuery object
> (the one you attach the plugin to)
>var current_margin = $(this).css('marginLeft'); // 'this' needs to
> be wrap
Personally, I'd use:
jQuery.fn.hover_menu = function(offset, speed){
this.find('').each(function(){ // 'this' is already a jQuery object
(the one you attach the plugin to)
var current_margin = $(this).css('marginLeft'); // 'this' needs to
be wrapped in a new jQuery object
});
Note w
Ok. I think i will use that way because too me it looks a lot cleaner.
bmsterling wrote:
>
> Eridius,
> Your plugin code will work, but the preferred method is the method that
> Bernd wrote.
>
> On 8/13/07, Eridius <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> everything you said there makes sense
Eridius,
Your plugin code will work, but the preferred method is the method that
Bernd wrote.
On 8/13/07, Eridius <[EMAIL PROTECTED]> wrote:
>
>
>
> everything you said there makes sense but the plugin code, i thought i
> made
> the plugin like this:
>
> jQuery.fn.hover_menu = function(offset, spe
I think what you are looking for is .children()
$('div[id=hover_menu]').hover_menu( $(this).children('li') )
Eridius wrote:
>
> I am trying to learn the working of making a intergrated plugin(with using
> jQuery.fn.plugin method). I thought a good start would be a simple
> hover_menu. Now m
everything you said there makes sense but the plugin code, i thought i made
the plugin like this:
jQuery.fn.hover_menu = function(offset, speed)
{
var self = this;
${self).children('').each(fucntion()
{
//grab current margin
var current_margin = this.css('marginLeft')
Hi Eridius,
yes, "this" refers to the object passed to the plugin, in your case
$('#hover_menu').hover_menu();
which would be shorter than
$('div[id=hover_menu]').hover_menu()
(function($)
{
$.fn.hover_menu = function(){
$(this).children('ul').children('li').hide();
};
})( jQu
11 matches
Mail list logo