Is Element Visible on screen (display) JS

Автор: Administrator.

function <strong>isElementVisible</strong>(elementToBeChecked)
{
   var TopView = $(window).scrollTop();
   var BotView = TopView + $(window).height();
   var TopElement = $(elementToBeChecked).offset().top;
   var BotElement = TopElement + $(elementToBeChecked).height();
   return ((BotElement = TopView));
}
<strong>Sample</strong>
map_diagram('.map_diagram');
function map_diagram(el){
   if(<strong>isElementVisible</strong>(el)){
      $(el).animate({'width': '360px',opacity: 1}, 1000);
   }
}

Built with HTML5 and CSS3 | Copyright © 2012 - 2015 Зарембо Александр