基于jQuery實(shí)現(xiàn)收縮展開功能
本文實(shí)例向大家分享了一款基于jQuery實(shí)現(xiàn)收起展開功能特效,供大家參考,具體內(nèi)容如下
效果圖:

點(diǎn)擊倒三角可以進(jìn)行展開操作
具體代碼:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>jQuery實(shí)現(xiàn)收起展開功能 - 何問起</title><base target="_blank" />
<meta charset="utf-8" />
<style>
a{color:darkgreen}
.hovertreeContent{width:300px;text-indent:2em;margin:5px auto;height:60px;overflow:hidden;position:relative;border:1px solid silver;}
.hewenqiToggle{height:20px;background-color:#f0f0f0;border-top:1px solid silver;position:absolute;bottom:0px;width:100%;}
.triangle-down-hovertree { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 16px solid #999;position:absolute;right:0px;left:0px;margin:0px auto; top:2px;cursor:pointer;}
.triangle-up-hovertree { width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 16px solid #999; position:absolute;right:0px;left:0px;margin:0px auto;top:2px; }
</style>
<script src="http://hovertree.com/ziyuan/jquery/jquery-1.12.1.min.js"></script>
</head>
<body>
<div style="width:730px;margin:0px auto;text-align:center;">
<h2>jQuery實(shí)現(xiàn)收起展開功能</h2>
<a href="#">原文</a> <a href="#">首頁(yè)</a> <a href="#">特效</a>
</div>
<div class="hovertreeContent">
受到網(wǎng)店的影響,服裝店的生意逐漸有所下降,老板找何問起去談,大概是準(zhǔn)備跟上網(wǎng)購(gòu)潮流,讓何問起準(zhǔn)備一下,
要在網(wǎng)上開網(wǎng)店,要為服裝店建立網(wǎng)站。
何問起也沒說自己經(jīng)驗(yàn)不足,只說會(huì)積極準(zhǔn)備。于是抓緊時(shí)間查找資料,學(xué)習(xí)練習(xí)。
<div class="hewenqiToggle"><span class="triangle-down-hovertree"></span></div>
</div>
<script>
$(".hewenqiToggle").on("click", function () {
if ($(".hewenqiToggle").css('position') == "absolute") {
$(".hovertreeContent").height("auto");
$(".hewenqiToggle").css({ "position": "relative" });
$(".hewenqiToggle").find("span").removeClass('triangle-down-hovertree').addClass('triangle-up-hovertree');
}
else
{
$(".hovertreeContent").height("60");
$(".hewenqiToggle").css({ "position": "absolute" });
$(".hewenqiToggle").find("span").removeClass('triangle-up-hovertree').addClass('triangle-down-hovertree');
}
})
</script>
</body>
</html>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家學(xué)習(xí)jquery程序設(shè)計(jì)有所幫助。
相關(guān)文章
jQuery.validate.js表單驗(yàn)證插件的使用代碼詳解
Validate是基于jQuery的一款輕量級(jí)驗(yàn)證插件,內(nèi)置豐富的驗(yàn)證規(guī)則,這篇文章主要介紹了jQuery.validate.js表單驗(yàn)證插件的使用代碼詳解,需要的朋友可以參考下2018-10-10
jquery+ajax實(shí)現(xiàn)上傳圖片并顯示上傳進(jìn)度功能【附php后臺(tái)接收】
這篇文章主要介紹了jquery+ajax實(shí)現(xiàn)上傳圖片并顯示上傳進(jìn)度功能,結(jié)合實(shí)例形式分析了jQuery+ajax結(jié)合layer.js插件與php后臺(tái)交互,實(shí)現(xiàn)顯示上傳進(jìn)度的相關(guān)操作技巧,需要的朋友可以參考下2019-06-06
JQuery實(shí)現(xiàn)表格中相同單元格合并示例代碼
一定要注意如果從list的開始元素循環(huán)下去,remove掉一個(gè)元素后,有些元素就找不到了或者說不是要找的那個(gè)元素,感興趣的各位可以研究下哈2013-06-06
jQuery插件FusionCharts實(shí)現(xiàn)的2D柱狀圖效果示例【附demo源碼下載】
這篇文章主要介紹了jQuery插件FusionCharts實(shí)現(xiàn)的2D柱狀圖效果,結(jié)合完整實(shí)例形式分析了FusionCharts插件繪制2D柱狀圖的實(shí)現(xiàn)步驟與相關(guān)屬性設(shè)置技巧,并附帶demo源碼供讀者下載參考,需要的朋友可以參考下2017-03-03
jQuery插件jcrop+Fileapi完美實(shí)現(xiàn)圖片上傳+裁剪+預(yù)覽的代碼分享
這篇文章主要介紹了jQuery插件jcrop+Fileapi完美實(shí)現(xiàn)圖片上傳+裁剪+預(yù)覽的代碼,非常的簡(jiǎn)單實(shí)用,效果也很棒,有需要的小伙伴可以參考下。2015-04-04
jQuery實(shí)現(xiàn)的無縫廣告圖片左右滾動(dòng)功能詳解
這篇文章主要介紹了jQuery實(shí)現(xiàn)的無縫廣告圖片左右滾動(dòng)功能,結(jié)合實(shí)例形式詳細(xì)分析了jQuery無縫滾動(dòng)圖片的實(shí)現(xiàn)原理、步驟與具體操作技巧,需要的朋友可以參考下2016-12-12
Jquery ajaxsubmit上傳圖片實(shí)現(xiàn)代碼
這是數(shù)月前的事情了,場(chǎng)景是這樣的: 在進(jìn)行圖片上傳的時(shí),我發(fā)現(xiàn)開發(fā)人員使用的上傳圖片方式是Iframe + 傳統(tǒng)的 http post 來處理的。2010-11-11

