Reputation: 85
Want to disable function if class name exists for particular container. Used below code.
if($("testElement1").hasClass("Content")){
!testFunction();
}
else{
}
Want to add inside (Existing code)
$(window).on('scroll', function(){
testFunction();
}
Thanks
Upvotes: 1
Views: 112
Reputation: 337590
If I've understood what you're trying to achieve, you just need to invert the logic in the if
condition:
$(window).on('scroll', function() {
// if test element *does not* have the class 'Content'
if (!$("testElement1").hasClass("Content"))
testFunction();
});
Upvotes: 1