jquery - How to decrement a font-size percentage with .css() -


i have jsfiddle here - http://jsfiddle.net/pbkt3nrx/1/ - want decrease font-size of html element 5% each time "shrink" button clicked. first click reduces font-size 62.5% (10px) 5px. there way this?

thanks

$(function(){        $('button#shrink').mousedown(function() {             $('html').css('font-size', '-=5%');       }); }); 

try this

$(function(){        $('button#shrink').mousedown(function() {             font = parseint($("html").css("font-size"));   //get current font-size             font = font-1;  //decrease font-size 1             $('html').css('font-size', font);  //apply new font-size current font-size         }); }); 

jsfiddle


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -