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

Python Kivy ListView: How to delete selected ListItemButton? -

asp.net mvc 4 - A specified Include path is not valid. The EntityType '' does not declare a navigation property with the name '' -