本篇文章主要是對(duì)jQuery

創(chuàng)新互聯(lián)公司是一家集網(wǎng)站建設(shè),云溪企業(yè)網(wǎng)站建設(shè),云溪品牌網(wǎng)站建設(shè),網(wǎng)站定制,云溪網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷(xiāo),網(wǎng)絡(luò)優(yōu)化,云溪網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力。可充分滿(mǎn)足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專(zhuān)業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶(hù)成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。
字體大小的設(shè)置方法進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助
先獲取字體大小,進(jìn)行處理。
再將修改的值保存。
slice()
方法可從已有的數(shù)組中返回選定的元素。
arrayObject.slice(start,end)。
start
必需。規(guī)定從何處開(kāi)始選取。如果是負(fù)數(shù),那么它規(guī)定從數(shù)組尾部開(kāi)始算起的位置。也就是說(shuō),-1
指最后一個(gè)元素,-2
指倒數(shù)第二個(gè)元素,以此類(lèi)推。
end
可選。規(guī)定從何處結(jié)束選取。該參數(shù)是數(shù)組片斷結(jié)束處的數(shù)組下標(biāo)。如果沒(méi)有指定該參數(shù),那么切分的數(shù)組包含從
start
到數(shù)組結(jié)束的所有元素。如果這個(gè)參數(shù)是負(fù)數(shù),那么它規(guī)定的是從數(shù)組尾部開(kāi)始算起的元素。
jQuery代碼如下:
代碼如下:
script
type="text/javascript"
$(function(){
$("span").click(function(){
//獲取para的字體大小
var
thisEle
=
$("#para").css("font-size");
//parseFloat的第二個(gè)參數(shù)表示轉(zhuǎn)化的進(jìn)制,10就表示轉(zhuǎn)為10進(jìn)制
var
textFontSize
=
parseFloat(thisEle
,
10);
//javascript自帶方法
var
unit
=
thisEle.slice(-2);
//獲取單位
var
cName
=
$(this).attr("class");
if(cName
==
"bigger"){
textFontSize
+=
2;
}else
if(cName
==
"smaller"){
textFontSize
-=
2;
}
//設(shè)置para的字體大小
$("#para").css("font-size",
textFontSize
+
unit
);
});
});
/script
html代碼如下:
代碼如下:
body
div
class="msg"
div
class="msg_caption"
span
class="bigger"
放大/span
span
class="smaller"
縮小/span
/div
div
p
id="para"
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
!doctype?html
html
head
titlejquery-ui/title
meta?html-equiv="content-type"?content="text/html,charset=utf-8"/meta
/head
link?rel="stylesheet"?href="
link?rel="stylesheet"?type="text/css"?href="css/nav.css"
script
$(function(){
??$("#menu").menu();??????????!---菜單樣式--
??$("#menu"?).draggable();???!---可拖動(dòng)--
??$("#menu").resizable();????!--放大/縮小--
??$("#tabs").tabs();
??$("#accordion").accordion();
???$(?"#sortable"?).sortable();??!--排序--
$(?"#sortable"?).disableSelection();
});
/script
style
body{
width:90%;
background:url(image/bg0.jpg);
margin:0?auto;
}
.ui-menu?{
???width:100px;
???text-align:center;
???margin:0?auto;
}
.ui-tabs{
?border:1px?solid?green;
}
#accordion{
??width:100%;
??height:200px;
}
.content{
?height:1000px;
?width:100%;
?border:5px?solid?#87CEFA;
?-moz-border-radius:?15px;
-webkit-border-radius:?15px;
border-radius:15px;
}
.cdown{?
???margin:0?auto;
???width:100%;
}
.ctop{
?margin:0?auto;
??width:100%;
???height:500px;
}
#tabs-1{
??background:url(image/p-bg1.jpg)?no-repeat;
}
#tabs-2{
??background:url(image/p-bg2.jpg)?no-repeat;
}
#tabs-3{
??background:url(image/p-bg3.jpg)?no-repeat;
}?
#tabs?ul?li{
background:#76EEC6;
}
?
.c{
??height:250px;
}
#sortable?image{
??width:155px;
margin-left:10px;
}
/style
body
nav
ul
lia?href="#"?首頁(yè)/a/li
lia?href="#"?第一/a/li
???lia?href="#"?第二/a/li
???lia?href="#"?第三/a/li
???lia?href="#"?第四/a/li
???lia?href="#"?關(guān)于我們/a/li
/ul
/nav
div?class="content"
div?class="ctop"
div?id="accordion"
h3圖片可重新排序/h3
div?class="c"?id="sortable"image?src="image/pic1.jpg"/image?src="image/pic2.jpg"/image?src="image/pic3.jpg"/image?src="image/pic4.jpg"/image?src="image/pic5.jpg"http://div
h3Second/h3
div?class="c"Second?Second?Second?Second?Second?Second?Second?Second?Second?Second?Second/div
h3Third/h3
div?class="c"Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third/div
/div
/div
div?class="cdown"
???div?id="tabs"
ul
lia?href="#tabs-1"?class="one"First/a/li
lia?href="#tabs-2"?Second/a/li
lia?href="#tabs-3"?Third/a/li
/ul
div?id="tabs-1"?class="c"First?First?First?First?First?First?First?First?First?First?First?First?First/div
div?id="tabs-2"?class="c"Second?Second?Second?Second?Second?Second?Second?Second?Second?Second?Second/div
div?id="tabs-3"?class="c"Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third?Third/div
/div
/div
/div
ul?id="menu"?class="ui-widget-content"
li?class="ui-state-disabled"?style="font-size:10px;text-align:center"菜單(可拖動(dòng))/li
lia?href="#"abcd/a
???ul
?lia?href="#"aaa/a/li
?lia?href="#"bbb/a/li
?lia?href="#"ccc/a/li
?lia?href="#"ddd/a/li
???/ul
?/li
??lia?href="#"efg/a
???ul
?lia?href="#"eee/a/li
?lia?href="#"fff/a/li
?lia?href="#"ggg/a/li
???/ul
?/li
/ul
/div
/body
/html
var div = $("div");
div.css("lfet",value);
div.css("top",value)
....同理
div.width(200) // 同樣也可以用上述css方式來(lái)實(shí)現(xiàn)。 div.css("width",value); height跟width一樣。
文章名稱(chēng):jquery放大縮小,js放大縮小的功能
轉(zhuǎn)載來(lái)源:http://chinadenli.net/article3/dsgcgos.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、品牌網(wǎng)站制作、App設(shè)計(jì)、網(wǎng)站策劃、企業(yè)建站、網(wǎng)站維護(hù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)