css - How do I use jQuery to activate a function only when a condition is met? -
i want activate jquery function if width of screen between x value , y value. tried this:
$(function(){ var width = window.innerwidth if (770 < width < 995 ) { $(function(){ var altezza = $(".modello").innerheight(); $(".modellato").css('min-height',altezza); }); } });
but didn't work. how can work?
im replying because there multiple factors can improved, require post:
$(function(){ var width = window.innerwidth if( width > 770 && width < 995 ){ $(".modellato").css('min-height', $(".modello").innerheight()); } });
- the if-statement very basic programming
- you don't need
$(function(){
insideif
, code run fine this - if use innerheight of
.modello
once, can use value in.css()
Comments
Post a Comment