SORU
16 Kasım 2010, Salı


bir çapa pürüzsüz kaydırma jquery?

bir çapa bağlantı aşağı jquery ile kaydırma yapmak için herhangi bir yolu var mı?

gibi:

$(document).ready(function(){
  $("#gotomyanchor").click(function(){
      $.scrollSmoothTo($("#myanchor"));
  });
});

?

CEVAP
3 EKİM 2012, ÇARŞAMBA


Bunu nasıl burada

    var hashTagActive = "";
    $(".scroll").click(function (event) {
        if(hashTagActive != this.hash) { //this will prevent if the user click several times the same link to freeze the scroll.
            event.preventDefault();
            //calculate destination place
            var dest = 0;
            if ($(this.hash).offset().top > $(document).height() - $(window).height()) {
                dest = $(document).height() - $(window).height();
            } else {
                dest = $(this.hash).offset().top;
            }
            //go to destination
            $('html,body').animate({
                scrollTop: dest
            }, 2000, 'swing');
            hashTagActive = this.hash;
        }
    });

O zaman böyle bir bağlantı oluşturmak için gereken:

<a class="scroll" href="#destination1">Destination 1</a>

Benim üzerinde website görebilirsiniz.
Ayrıca burada bir gösteri: http://jsfiddle.net/YtJcL/

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • DorkmanScott

    DorkmanScott

    14 NİSAN 2006
  • ETrade Supply

    ETrade Suppl

    23 Temmuz 2011
  • WiseOwlTutorials

    WiseOwlTutor

    21 EKİM 2011