JavaScript: click button font amplification and downsize _ javascript skills

Source: Internet
Author: User
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 ') ;}); script

Style 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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.