Reputation: 21
I want a div (#expand) to appear when window is >=650 as long as another div (.sr) is not displaying (this is, I need two conditions).
I have this working code so far, but I'm not sure how to add the second condition.
<script type="text/javascript">
$(window).resize(function(){
var w = window.innerWidth;
if(w >= 650){
$("#expand").css('display','inline-block');
}
else {
$("#expand").css('display','none');
}
});
</script>
Thanks a lot.
Upvotes: 0
Views: 50
Reputation: 4125
You can use &&
to add another condition: && $(".sr").css("display") == "none"
$(window).resize(function(){
var w = window.innerWidth;
if(w >= 650 && $(".sr").css("display") == "none"){ //added code here
$("#expand").css('display','inline-block');
}
else {
$("#expand").css('display','none');
}
});
Upvotes: 2