Javascript/Bootstrap scroll to section only after the page loads

  • Status Concluído
  • Budget $10 - $30 USD
  • Total Bids 22

Descrição do Projeto

We have a website which uses jquery to scroll to a previously opened section when the user visits a page. It is using the bootstrap code below to get the previous section via a cookie and then scroll to it.

$(".collapse").on('[url removed, login to view]', function(e) {

var scrollToSection = $.cookie('scrollToSection');

if (scrollToSection != null && $("#" + scrollToSection).length) {

$('html, body').animate({

scrollTop: $('#' + scrollToSection).offset().top

}, 1000);

}

}

This works fine, but if the user expands a section after the page loads it will still scroll to the previous section. We want to fix this so that it only scrolls to the active section when the page first loads. If you are interested in the project let me know and I can walk you through the process to replicate this on our development site.

Obter orçamentos grátis para um projeto como este
Concluído por:
Habilidades Requeridas

Pretende fazer algum dinheiro?

  • Definir seu orçamento e prazo
  • Esboce sua proposta
  • Seja pago por seu trabalho

Contratar freelancers que também ofereça neste projeto

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online