SORU
26 Kasım 2009, PERŞEMBE


Nasıl görünüm (eleman.bir tabloya bir satır kaydırma mı scrollıntoview) kullanarak bir WordPress kullanmak?

Dinamik olarak bir tablo jQuery kullanarak satır ekliyorum. table overflow:auto böylece dikey bir kaydırma çubuğu neden olan div içinde.

Şimdi benim kap div son satır oto etmek istiyorum. tr.scrollintoView() jQuery versiyonu nedir?

thx

CEVAP
23 EYLÜL 2010, PERŞEMBE


Bu aşağıdaki listeden rastgele bir öğe (yerine hep alt) gidin gerekirse: daha iyi çalışır

function scrollIntoView(element, container) {
  var containerTop = $(container).scrollTop(); 
  var containerBottom = containerTop   $(container).height(); 
  var elemTop = element.offsetTop;
  var elemBottom = elemTop   $(element).height(); 
  if (elemTop < containerTop) {
    $(container).scrollTop(elemTop);
  } else if (elemBottom > containerBottom) {
    $(container).scrollTop(elemBottom - $(container).height());
  }
}

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

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • erikbjgn's channel

    erikbjgn's c

    12 Mayıs 2008
  • KendrickLamarVEVO

    KendrickLama

    9 ŞUBAT 2011
  • Michael Lummio

    Michael Lumm

    25 Mayıs 2007