0

Here is the implementation of the back button. I really don't know how to resolve this issue.

$("#back").click(function(){
    event.preventDefault();
    var string = $("section:not(.hidden)").attr("id");
    var num = string.charAt(10);
    $("#portfolio_" + (num-1)).removeClass("hidden");
    var $anchor = $(this);
    $('html, body').animate({
    scrollTop: ($("#portfolio_" + (num-1)).offset().top)
    }, 1250, 'easeInOutExpo');
    setTimeout(function(){$("#portfolio_" + (num)).addClass("hidden")}, 2500);
});
5
  • Can you specify your question? What is exaclty happening and what should it do?
    – Luca
    Aug 3, 2015 at 13:20
  • It should return to previous section, and do animation while doing that. But, when it's like this, it jumps on previous section after this line: $("#portfolio_" + (num-1)).removeClass("hidden"); and then it doesn't animate. It should slide back with animation. I hope i explained it well? :)
    – bubble
    Aug 3, 2015 at 13:31
  • I feel there is some error. You have event.preventDefault(); but you never included event in your function like .click(function(event){. Is that typo? Aug 3, 2015 at 13:39
  • post some dummy html too if possible to create problem workaround Aug 3, 2015 at 13:40
  • No, it doesn't change when i type event. I will try to make some dummy HTML, it is a bit complicated with all this. Thank you for answers.
    – bubble
    Aug 3, 2015 at 13:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.