hakanersu
10/3/2013 - 10:03 AM

View görünürmü

View görünürmü

// desc: Given a DOM element elem, tell me if this is scrolled into view yet
// usage: isScrolledIntoView('.timeframe') 
// returns: Boolean
function isScrolledIntoView(elem)
{
	if ($(elem).length > 0){
    var st = (document.documentElement.scrollTop || document.body.scrollTop),
        ot = $(elem).offset().top,
        wh = (window.innerHeight && window.innerHeight < $(window).height()) ? window.innerHeight : $(window).height();
    return ot > st && ($(elem).height() + ot) < (st + wh);		
  } else { 
    return false; 
  }
}