The font size can be adjusted, which greatly satisfies the user experience. Next, we will introduce JavaScript to enlarge the font and narrow down the instance code by clicking the button, for more information, see the following Section. This article will share with you the js implementation. click the button to zoom in and out the instance Code. The Code is easy to understand. For more information, see.
The Code is as follows:
Script $ (document ). ready (function () {$ ('p. aa '). addClass ('bb '); $ ('a [href ^ = "http:"]'). addClass ('cc'); // $ ('# switcher-large '). on ('click', function () {// $ ('p. large '). addClass ('Chapter '); //}); $ (' # switcher-large '). click (function () {$ ('p. large '). toggleClass ('Chapter '); $ (this ). toggleClass ('bb ') ;}); // $ (' # switcher '). click (function () {// click the button to add (remove) the style (toggleClass method) // $ ('# switcher button '). toggleClass ('den den '); // zoom in and out the font var $ biger =$ ('p. large '); var num = parsefloat(javasbiger.css ('fontsize'); $ (' # switcher-bigger '). click (function () {num = num * 1.4;$$biger.css ('fontsize', num + 'px') ;}); $ ('# switcher-small '). click (function () {num = num/1.4;$biger.css ('fontsize', num + 'px ') ;}); scriptStyle SwitcherDefaultNarrow hiddenLarge PrintSwitcher-biggerSwitcher-small
Foot home
Foot home
Foot home
Foot home
I would like to introduce so much about how to zoom in and zoom out the font of the buttons in JavaScript. I hope this will be helpful to you!