Skip to main content

Bug Tracker

Side navigation

#6729 closed bug (duplicate)

Opened June 26, 2010 11:15PM UTC

Closed October 21, 2010 06:59PM UTC

Last modified October 21, 2010 06:59PM UTC

function unbind() doesnot remove internal variables in function toggle()

Reported by: Marco Antonio Avella Owned by:
Priority: low Milestone: 1.5
Component: event Version: 1.4.2
Keywords: toggle() unbind() Cc:
Blocked by: Blocking:
Description

when i want to delete the listener for a function toogle() for example: (i use the next funcion for show and hidden a fixed menu in the bottom of the page)

___________ begin

jQuery('.libreria_titulo').toggle( function () {

jQuery('a',jQuery(this)).stop().animate({'marginBottom':'-155px'},200);

jQuery('.libreria_holder').stop().animate({'marginBottom':'-155px'},200);

return false;

},

function () {

jQuery('a',jQuery(this)).stop().animate({'marginBottom':'-2px'},200);

jQuery('.libreria_holder').stop().animate({'marginBottom':'-2px'},200);

return false;

}

);

__________end

when i use the unbind funcion to delete the listener en toggle function, (i have to say that i have to delete the listener because i use other button either to show o hidden the fixed menu, but without using toggle) i erase the listener this way:

jQuery('.libreria_titulo').unbind();

this unbind function do not remove o delete the internal toogle variable that i supouse is been used for the cicle, because when i create another toogle function (new function after i unbind the last toggle) to the same selector the cicle begin when the last toogle function ended)

it is necesary to remove this internal variable because when i move my menu ( show o hidden position) from other source (diferente of manual toggle, for example a button in other part of the page that show up my fixed menu), and then i create another toggle function with the same selector, when i make manual click to execute the toggle this does not hidden (move down) until another (second) click i made, because the last toggle function ended in the hidden position so that when i made the first click (using the new toogle function) my menu try to show (when actually is in the show position because it was moved up previusly by the button ) and until the second click is made my menu hidden correctly and makes the toggle right

if the internal variable were erased the same way as the listener (with the unbind function) it were no mather where was the last toggle when i create a new toggle function with the same selector (for example id make a function that starts showing the menu with the firt click always), and then i just try to erase and create new toggle function after using the button (to show and/or hidden) and when the actual position of the menu were hidden.

Attachments (0)
Change History (3)

Changed June 27, 2010 12:45AM UTC by dmethvin comment:1

component: unfiledevent

Relevant to the proposal for .untoggle() in #234.

Changed October 21, 2010 06:59PM UTC by SlexAxton comment:2

milestone: 1.4.31.5
priority: → low
resolution: → duplicate
status: newclosed

I'm gonna go ahead and just set this as a dupe of #234 - since it's the best solution to the problem described here...

Changed October 21, 2010 06:59PM UTC by SlexAxton comment:3

Duplicate of #234.