jquery font Zoom Zoom plugin zoomfontsize.js

Source: Internet
Author: User

Plugin Description: jquery font zoom zoom plugin zoomfontsize.js percent scaling based on parent class, compatibility as follows: How to use

The class property of the body is added changbody_fontsize and the Font property of the entire page is set to percent (except body)

Disadvantages:

1. Need to scale according to the parent class percentage

2.Chrome font scaling minimum is 12px and cannot be scaled

Plugin Source:

1 //JavaScript Document2 //width of the screen3 //width of the screen4     varWidth_srceen =Screen.width;5     varFont_size = "";6     //Execute when window is scaled7Window.onresize=function(){8Changbody_fontsize (". Chang_fontsize");9     }Ten     //Execute at load time OneWindow.onload =function(){ A$ ("HTML"). CSS ("-webkit-text-size-adjust") -, "None"); -Font_size = $ (". Chang_fontsize"). CSS ("Font-size"). Split ("px") [0]; the changbody_fontsize (); -     } -     //font scaling based on the width of the screen and multiples of the form -     functionchangbody_fontsize (obj) { +         varNew_window_width =$ (window). width (); -         varmultiple =new_window_width/width_srceen; +         varHi =font_size *multiple; A$ (". Chang_fontsize"). CSS ("font-size", hi+ "px" ); at     } -     

Instance:

1 <!DOCTYPE HTML>2 <HTMLxmlns= "http://www.w3.org/1999/xhtml">3 <Head>4 <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />5 <title>Font Scaling</title>6 <Scriptsrc= "Jquery-1.10.2.min.js"></Script>7 <Scriptsrc= "Zoomfontsize.js"></Script>8 <style>9 Body{    Ten font-size:26px; One     } A . size52px{ - font-size:200%; -     } the  - . size26px{ - font-size:100%; -     } + ul Li{ - Padding-bottom:40px; +     } A     . Explain{ at Margin-top:100px; - font-size:80%; - Margin-bottom:200px; -     } -     . Explain ul Li{ - Padding-bottom:2px; in     } -  to </style> + </Head> - <Bodyclass= "Chang_fontsize"> the         <Divclass= "Explain"> *How to: Add Changbody_fontsize to the body's class property and set the Font property of the entire page to percent (except body)<BR/> $Disadvantages:<ul>Panax Notoginseng                     <Li>1. Need to scale according to the parent class percentage</Li> -                     <Li>2.Chrome font scaling minimum is 12px and cannot be scaled</Li> the                  </ul> +         </Div> A         <Divclass= "size52px"> theGlobal Scaling:<BR/> +             <ul> -                     <binstyle= "Font-size:100%;color: #c0f"> $ The current class is the 100% (52px) of the parent class-(body:26px; parent body's 200%[52px]) $                     </Li> -                     <Listyle= "Font-size:50%;color: #f00"> - The current class is the 50% (26PX) of the parent class-(body:26px; parent body's 200%[52px]) the                     </Li> -                     <Listyle= "Font-size:40%;color: #000">Wuyi The current class is the 20% (20.8px) of the parent class-(body:26px; parent body's 200%[52px]) the                     </Li> -             </ul> Wu         </Div> -         <Divstyle= "FONT-SIZE:26PX;"> AboutLocal scaling:<BR/>     $                 <ulclass= "Chang_fontsize"> -                     <Listyle= "Font-size:100%;color: #c0f"> - The current class is the 100% of the parent class;(26px)-(The parent class is: 26px) -                     </Li> A                     <Listyle= "Font-size:80%;color: #f00"> + The current class is the 80% of the parent class;(20.8px)-(The parent class is: 26px) the                     </Li> -                     <binstyle= "Font-size:50%;color: #000"> $ The current class is the 50% of the parent class;(20.8px)-(The parent class is: 26px) the  the                     </Li> the                 </ul> the         </Div> - </Body> in </HTML>

Original address: http://www.jq22.com/jquery-info579

jquery font Zoom Zoom plugin zoomfontsize.js

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.