2

I'm pretty new to jquery and i'm pretty stuck with this one. i know it will be something stupid but i have been breaking my head on it for to long.

I want to toggle between the 2 or more functions to animate de specific div's in the site. But i end up making the menu item invisible.

Thanks in advance!

$(document).ready(function() {

    $("#menu-item-13 a").toggle(
    function () {
        $("#branding").animate({left:416,top:176}).css('z-index', 12);
        $("#a").animate({left:659,top:175});
        $("#post-2").animate({left:160,top:177});
        $("#post-48").animate({left:402,top:324});
        $("nav").animate({left:174,top:56});
        $("#post-30").animate({left:403,top:842});
        $("#post-1").animate({left:902,top:528});
        $("#post-60").animate({left:903,top:55});
        },

    function () {
        $("#branding").animate({left:545,top:176}).css('z-index', 12);
        $("#a").animate({left:84,top:175});
        $("#post-2").animate({left:160,top:85});
        $("#post-48").animate({left:45,top:324});
        $("nav").animate({left:174,top:56});
        $("#post-30").animate({left:403,top:842});
        $("#post-1").animate({left:902,top:528});
        $("#post-60").animate({left:903,top:55});
        });

});
Jannik
  • 53
  • 8

1 Answers1

4

This version of toggle(.toggle(function{}, function(){})) was removed in jQuery version 1.9, so if you are using a version > 1.9 then calling toggle will switch the display of the element.

If you want to add back the support for the removed features, you can include the migration plugin as specified in the upgrade notes

Arun P Johny
  • 384,651
  • 66
  • 527
  • 531
  • +1 and here is an implementation of the functionality [What to use instead of `toggle(…)` in jQuery > 1.8?](http://stackoverflow.com/a/14383246/128165) – Gabriele Petrioli Sep 24 '13 at 12:10
  • Hey thank you for the information. i tried to fix the problem with a new toggle function but now nothing happens at all. here is the code: http://jsfiddle.net/Jannikdolferus/futby/ – Jannik Sep 24 '13 at 13:08
  • 1
    @user2810940 it should be like http://jsfiddle.net/arunpjohny/futby/1/ .. else the methods `een` and `twee` are private to the dom ready callback methods – Arun P Johny Sep 24 '13 at 13:16