国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

jQuery實(shí)現(xiàn)的多滑動(dòng)門(mén),多選項(xiàng)卡效果代碼

2019-11-20 10:20:21
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

本文實(shí)例講述了jQuery實(shí)現(xiàn)的多滑動(dòng)門(mén),多選項(xiàng)卡效果。分享給大家供大家參考,具體如下:

運(yùn)行效果截圖如下:

具體代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><script language="javascript" src="jquery-1.4.2.min.js"></script><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>超多滑動(dòng)門(mén)效果</title><style type="text/css">* {  margin:0;  padding:0;}body {  font-size:12px;}ul, li {  list-style-type:none;}#tab {  width:500px;  height:200px;  margin:20px auto;  overflow:hidden;}#tab .tab_title {  width:500px;  height:22px;  overflow:hidden;  left:0;  top:0;  clear:both;  overflow:hidden;  position:relative;}#tab .tab_title .u {  width:465px;  overflow:hidden;  position:relative;}#tab .tab_title ul {  margin:0 5px;  position:absolute;  float:left;  width:2784px;/*這個(gè)即是滑動(dòng)門(mén)的總長(zhǎng)度!就是所有的li的寬度加上間距!計(jì)算本案例中的寬度即為:24*100+14*24+24*2(2為邊框?qū)挾龋?2784 */}#tab .tab_title div {  float:left;  width:15px;  height:20px;  line-height:20px;  cursor:pointer;}#tab .tab_title span.vright {  top:0;  right:5px;  margin-left:2px;}#tab .tab_title span.vleft {  top:0;  left:0px;  padding-left:5px;}#tab .tab_title li {  float:left;  width:100px;/*這個(gè)的寬度即是四個(gè)滑動(dòng)門(mén)欄目的寬度*/  height:20px;  line-height:20px;  text-align:center;  background-color:#cccccc;  margin-right:14px;  border:1px #999999 solid;  cursor:pointer;}#tab .tab_title li:hover {  background-color:#999999}#tab .tab_title li.selected {  background-color:#666666;}#tab .tab_content {  width:476px;  height:156px;  overflow:hidden;  padding:10px;  border:1px #CCCCCC solid;}#tab .tab_content div {  border:1px #999999 dotted;}#tab .tab_content div p {  line-height:1.5;  text-indent:25px;  color:#333333;}#tab .tab_content .none {  display:none;}#div1 {  border:1px #CCCCCC solid;  position:absolute;  display:none;  background:#EEF7EE;  font-size:12px;  padding:5px;  color:#999999;}#div2 {  width:120px;  height:15px;  border:1px #CCCCCC solid;  position:absolute;  display:none;  background:#CCCCCC;  font-size:5px;  padding:2px;  color:#999999;}</style><script language="javascript"> $(function(){ var index = 0; $(".tab_title ul li").click(function(){  index = $(".tab_title ul li").index(this);  $(this).addClass("selected").siblings().removeClass("selected");  $(".tab_content div").eq(index).show().siblings().hide(); }); var i = 4; //這個(gè)前端展示幾個(gè)滑動(dòng)門(mén)欄目 var len = $(".u .scrol li").length; var page = 1; var maxpage = Math.ceil(len/i); var scrollWidth = $(".u").width(); var divbox = "<div id='div1' >呵呵,沒(méi)有了</div>"; $("body").append(divbox); $(".vright").click(function(e){  if(!$(".u .scrol").is(":animated")){  if(page == maxpage ){  $(".u .scrol").stop();  $("#div1").css({   "top": (e.pageY + 20) +"px",   "left": (e.pageX + 20) +"px",   "opacity": "0.9"  }).stop(true,false).fadeIn(800).fadeOut(800);  }else{  $(".u .scrol").animate({left : "-=" + scrollWidth +"px"},2000);  page++;  }  } }); $(".vleft").click(function(){ if(!$(".u .scrol").is(":animated")){  if(page == 1){  $(".u .scrol").stop();  }else{  $(".u .scrol").animate({left : "+=" + scrollWidth +"px"},2000);  page--;  }  } }); });</script></head><body><div id="tab"> <div class="tab_title">  <div class="vleft"><strong><<</strong></div>  <div class="u">   <ul class="scrol">    <li class="selected">1</li>    <li>2</li>    <li>3</li>    <li>4</li>    <li>5</li>    <li>6</li>    <li>7</li>    <li>8</li>    <li>9</li>    <li>10</li>    <li>11</li>    <li>12</li>    <li>13</li>    <li>14</li>    <li>15</li>    <li>16</li>    <li>17</li>    <li>18</li>    <li>19</li>    <li>20</li>    <li>21</li>    <li>22</li>    <li>23</li>    <li>24</li>   </ul>  </div>  <div class="vright"><strong>>></strong></div> </div> <div class="tab_content">  <div>   <p>1的內(nèi)容</p>  </div>  <div class="none">   <p>2的內(nèi)容</p>  </div>  <div class="none">   <p>3的內(nèi)容</p>  </div>  <div class="none">   <p>4的內(nèi)容</p>  </div>  <div class="none">   <p>5的內(nèi)容</p>  </div>  <div class="none">   <p>6的內(nèi)容</p>  </div>  <div class="none">   <p>7的內(nèi)容</p>  </div>  <div class="none">   <p>8的內(nèi)容</p>  </div>  <div class="none">   <p>9的內(nèi)容</p>  </div>  <div class="none">   <p>10的內(nèi)容</p>  </div>  <div class="none">   <p>10的內(nèi)容</p>  </div>  <div class="none">   <p>12的內(nèi)容</p>  </div>  <div class="none">   <p>13的內(nèi)容</p>  </div>  <div class="none">   <p>14的內(nèi)容</p>  </div>  <div class="none">   <p>15的內(nèi)容</p>  </div>  <div class="none">   <p>16的內(nèi)容</p>  </div>  <div class="none">   <p>17的內(nèi)容</p>  </div>  <div class="none">   <p>18的內(nèi)容</p>  </div>  <div class="none">   <p>19的內(nèi)容</p>  </div>  <div class="none">   <p>20的內(nèi)容</p>  </div>  <div class="none">   <p>21的內(nèi)容</p>  </div>  <div class="none">   <p>22的內(nèi)容</p>  </div>  <div class="none">   <p>23的內(nèi)容</p>  </div>  <div class="none">   <p>24的內(nèi)容</p>  </div> </div></div></body></html>

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專(zhuān)題:《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery常見(jiàn)經(jīng)典特效匯總》、《jQuery動(dòng)畫(huà)與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)

希望本文所述對(duì)大家jQuery程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 太谷县| 枣庄市| 毕节市| 垫江县| 湟源县| 仁怀市| 阿克苏市| 防城港市| 棋牌| 永吉县| 林周县| 合水县| 沈阳市| 义马市| 阜新| 清镇市| 平南县| 滨州市| 桂东县| 平山县| 和田县| 桐柏县| 新和县| 沙洋县| 都兰县| 公主岭市| 河间市| 蕉岭县| 林周县| 涪陵区| 定结县| 凭祥市| 永德县| 三台县| 会泽县| 万年县| 彝良县| 玉树县| 吴忠市| 丽江市| 凤山县|