SORU
16 Mayıs 2009, CUMARTESİ


Çapraz tarayıcı penceresinin scrollTop algılama yöntemi

Tarayıcı penceresinin scrollTop tespit etmek için çapraz tarayıcı en iyi yolu nedir? Bu çok basit bir script olduğu için önceden oluşturulmuş herhangi bir kod Kütüphanesi kullanmamayı tercih ediyorum, ve bu işe yaramaz adama gerek yok.

CEVAP
16 Mayıs 2009, CUMARTESİ


function getScrollTop(){
    if(typeof pageYOffset!= 'undefined'){
        //most browsers except IE before #9
        return pageYOffset;
    }
    else{
        var B= document.body; //IE 'quirks'
        var D= document.documentElement; //IE with doctype
        D= (D.clientHeight)? D: B;
        return D.scrollTop;
    }
}

alert(getScrollTop())

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • RocketJump

    RocketJump

    22 ŞUBAT 2006
  • theKGB65

    theKGB65

    24 Aralık 2007
  • TheScorpioTechno

    TheScorpioTe

    15 Aralık 2010