jquery - Slide doesn't work at the second time -


when click on navigation links, current div should slide , new should come down, works once.

jsfiddle

 $(".nav-link").click(function(){        var page = $(this).data("page");        var active = $("#viewport").data("active");        $(active).slideup(500, function(){            $(active).css({'display':'none'});            $(page).slidedown(250);            $("#viewport").attr("data-active", page);        });     }); 

i have no idea wrong.

thanks!

try using .data() instead of attr(), they're not exact same

$(".nav-link").click(function(){    var page = $(this).data("page");    var active = $("#viewport").data("active");    $(active).slideup(500, function(){        $(active).css({'display':'none'});        $(page).slidedown(250);        $("#viewport").data("active", page); // updated row    }); }); 

for further reading:


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo