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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -