1.is(':visible')
2//Selects all elements that are visible.
3
4if($('#yourDiv').is(':visible')){
5 //do stuff in here
6}
7//or
8$('#yourDiv:visible').callYourFunction();
1.is(':visible')
2//Selects all elements that are visible.
3
4if($('#Div').is(':visible')){
5 // add whatever code you want to run here.
6}
7
8$('#yourDiv:visible').callYourFunction();
1// Checks css for display:[none|block], ignores visibility:[true|false]
2$(element).is(":hidden");
3
1$.fn.isInViewport = function() {var elementTop = $(this).offset().top;var elementBottom = elementTop + $(this).outerHeight();var viewportTop = $(window).scrollTop();var viewportBottom = viewportTop + $(window).height();return elementBottom > viewportTop && elementTop < viewportBottom;};