The toggle function keeps track of the click count internally and
calls the callback function based on that, and not based on the status
of your elements. This means clicking on something else that modifies
your elements will not affect the internal toggle count. I suggest,
rather than using toggle, use a simple click event and do a condition
check of your element and perform your action based on that.

On Mar 19, 9:20 am, Rodrigo <rodrigo.z...@gmail.com> wrote:
> Hi,
> I've an issue using .toggle({unction(){}, function(){});
> It works fine if I toggle the element, however, if I click on it to
> open and then hide it through another element (a button), the next
> time I have to click twice to re-open the content.
>
> Example:
> $(".button").click(function() {
>         $(".title").next(".content").hide();
>
> });
>
> $(".title").toggle(function(){
>         $(this).next(".content").show().html('a');},function(){
>
>         $(this).next(".content").hide().html('');
>
> });
>
> orhttp://zrod.awardspace.com/
>
> Am I missing something?
> Thanks

Reply via email to