jquery Web page font size changed

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">    $(function(){        $("Span"). Click (function(){            varThisele = $ ("#para"). CSS ("Font-size")); varTextfontsize = parsefloat (Thisele, 10);
//parsefloat (the first parameter, 10) 10 indicates a conversion to 10 binary
Http://www.w3school.com.cn/jsref/jsref_parseFloat.asp
var//
                        //The Arrayobject.slice (start,end) method returns the selected element from an existing array.                             //start required. Specify where to start the selection. If it is a negative number, it specifies the position from the end of the array. In other words, 1 refers to the last element, 2 refers to the second-lowest element, and so on.                             //End is optional. Specifies where to end the selection. The parameter is the array subscript at the end of the array fragment. If this parameter is not specified, then the segmented array contains all elements from start to end of the array. If//This parameter is a negative number, it specifies the element starting from the tail of the array. Http://www.w3school.com.cn/jsref/jsref_slice_array.asp            varCName = $ ( This). attr ("Class"); Console.info ("Thisele:" + Thisele + "Textfontsize:" + textfontsize + "unit:" + unit + "CName:" +cName);
//thisele:16px textfontsize:16 unit:px cname:bigger if(CName = = "bigger")){ if(Textfontsize <= 22) {textfontsize+ = 2; } }Else if(CName = = "smaller")){ if(Textfontsize >= 12) {textfontsize-= 2; } } $("#para"). CSS ("Font-size", Textfontsize +unit); }); }); </script>This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. This is some text. </p> </div></div></body>

Css

* {margin:0; padding:0;}. msg {width:300px; margin:100px;}. msg_caption {width:100%; overflow:hidden; margin-bottom:1px;}. Msg_caption span {display:block; float:left; margin:0 2px; PADDING:4PX 10px; Background: #898989; Cursor:pointer;font-size:12px;color:white; }.msg textarea{width:300px; height:80px;height:100px;border:1px solid #000;}

  

jquery Web page font size changed

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.