javascript - targeting class in script -


i have following script (i want to) adds '.shrink' class quarter-circle class div.

<script> $(function(){  var shrinkheader = 50;  $(window).scroll(function() {  var scroll = getcurrentscroll();   if ( scroll >= shrinkheader ) {        $('quarter-circle').addclass('shrink');     }     else {         $('quarter-circle').removeclass('shrink');     }  });  function getcurrentscroll() {     return window.pageyoffset || document.documentelement.scrolltop; } }); </script>  <div class="quarter-circle"></div> 

but doesn't target it, not sure why.

edit- trying apply when class added

css

.quarter-circle.shrink {   height: 75px;   width: 75px; } 

class selector .(dot) not empty character.

so $('.quarter-circle') answer.

edit:

your div.quarter-circle has no content , width , height aren't specified(so 0x0px size) made example fiddle help. check out.

fiddle : http://jsfiddle.net/9k4hk57a/


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -