jQuery實現(xiàn)定位滾動條位置
698
2024-02-22
本文實例向大家分享了一款基于jQuery實現(xiàn)收起展開功能特效,供大家參考,具體內(nèi)容如下
效果圖:
點擊倒三角可以進行展開操作
具體代碼:
<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實現(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實現(xiàn)收起展開功能</h2> <a >原文</a> <a >首頁</a> <a >特效</a> </div> <div class="hovertreeContent"> 受到網(wǎng)店的影響,服裝店的生意逐漸有所下降,老板找何問起去談,大概是準備跟上網(wǎng)購潮流,讓何問起準備一下, 要在網(wǎng)上開網(wǎng)店,要為服裝店建立網(wǎng)站。 何問起也沒說自己經(jīng)驗不足,只說會積極準備。于是抓緊時間查找資料,學(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>
以上就是本文的全部內(nèi)容,希望對大家學(xué)習(xí)jquery程序設(shè)計有所幫助。
#免責聲明#
本站[綠夏技術(shù)導(dǎo)航]提供的一切軟件、教程和內(nèi)容信息僅限用于學(xué)習(xí)和研究目的;不得將上述內(nèi)容用于商業(yè)或者非法用途,否則,一切后果請用戶自負。本站信息來自網(wǎng)絡(luò)收集整理,版權(quán)爭議與本站無關(guān)。您必須在下載后的24個小時之內(nèi),從您的電腦或手機中徹底刪除上述內(nèi)容。如果您喜歡該程序或內(nèi)容,請支持正版,購買注冊,得到更好的正版服務(wù)。我們非常重視版權(quán)問題,如有侵權(quán)請郵件[admin@lxwl520.com]與我們聯(lián)系進行刪除處理。敬請諒解!