国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

目錄
HTML:
2014
CSS
js:
swiper使用方法
首頁(yè) web前端 js教程 jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果

jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果

Sep 09, 2022 am 10:12 AM
jquery swiper

根據(jù)時(shí)間軸進(jìn)行tab頁(yè)面內(nèi)容切換?以下這篇文章跟大家介紹一下jquery時(shí)間軸tab切換效果實(shí)現(xiàn)結(jié)合swiper實(shí)現(xiàn)滑動(dòng)顯示效果的方法,希望對(duì)大家有幫助!

jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果

需求:根據(jù)時(shí)間軸進(jìn)行tab頁(yè)面內(nèi)容切換(時(shí)間軸需要滑動(dòng)查看並選擇)

#實(shí)現(xiàn)想法:

結(jié)合swiper插件實(shí)現(xiàn)滑動(dòng)顯示效果

根據(jù)transform: translateX進(jìn)行左側(cè)切換效果的實(shí)現(xiàn)(具體實(shí)現(xiàn)css如下),實(shí)現(xiàn)非滾動(dòng)的點(diǎn)擊切換效果,結(jié)合swiper進(jìn)行修改。 【相關(guān)教學(xué)建議:jQuery教學(xué)

實(shí)作效果:

jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果

實(shí)作程式碼: 需要配合swiper元件使用;左側(cè)導(dǎo)覽是依據(jù)html結(jié)構(gòu)和css3程式碼,來(lái)產(chǎn)生的時(shí)間軸效果效果來(lái)自http://www.htmleaf.com/css3/ui-design/201911275850.html

Swiper基礎(chǔ)示範(fàn)網(wǎng)址:https://www.swiper.com.cn/demo/index.html

HTML:

??<div>
????<div>
??????<div>
????????<a>
??????????<div>
????????????<span>2019</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
??????<div>
????????<a>
??????????<div>
????????????<span>2018</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
??????<div>
????????<a>
??????????<div>
????????????<span>2017</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
??????<div>
????????<a>
??????????<div>
????????????<span>2016</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
??????<div>
????????<a>
??????????<div>
????????????<span>2015</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
??????<div>
????????<a>
??????????<div>
????????????<span>2014</span>
??????????</div>
????????</a>
????????<div></div>
??????</div>
????</div>
??</div>
??
    ????
    ??????

    2019

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ????
    ??????

    2018

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ????
    ??????

    2017

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ????
    ??????

    2016

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ????
    ??????

    2015

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ????
    ??????

    2014

    ??????jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果 ????
    ??
??

#所需外部連結(jié)檔:

<script></script>??
<script></script>??
<link>

CSS

.page?{
??width:?100%;
}
?
.main-timeline?{
??font-family:?'Roboto',?sans-serif;
??width:?200px;
??position:?relative;
??float:?left;
}
?
.main-timeline:after?{
??content:?'';
??display:?block;
??clear:?both;
}
?
.main-timeline:before?{
??/*?content:?'';
??height:?calc(100%?+?80px);
??width:?0px;
??border:?2px?solid?#0870C5;
??transform:?translateX(-50%);
??position:?absolute;
??left:?114px;
??top:?0px;?*/
}
?
.main-timeline?.timeline?{
??width:?4%;
??/*?padding:?140px?70px?0?25px;?*/
??margin:?0?50px?0?0;
??float:?left;
??position:?relative;
}
?
.main-timeline?.timeline-content?{
??/*?padding:?15px?15px?15px?40px;
??border:?2px?solid?#00A79B;?*/
??border-radius:?15px?0?15px?15px;
??display:?block;
??position:?relative;
}
?
.main-timeline?.timeline-content:hover?{
??text-decoration:?none;
}
?
.fd-active-line?.timeline-content:after?{
??content:?'';
??background-color:?#00A79B;
??height:?18px;
??width:?15px;
??position:?absolute;
??right:?-43px;
??top:?27px;
??/*?clip-path:?polygon(100%?0,?0?0,?0?100%);?*/
}
?
.main-timeline?.timeline-year?{
??color:?#fff;
??background-color:?#00A79B;
??font-size:?24px;
??font-weight:?900;
??text-align:?center;
??line-height:?80px;
??height:?80px;
??width:?80px;
??border-radius:?50%;
??position:?absolute;
??right:?-120px;
??top:?-40px;
}
?
.main-timeline?.timeline-year:after?{
??content:?'';
??height:?100px;
??width:?100px;
??border:?8px?solid?#00A79B;
??border-left-color:?transparent;
??border-radius:?50%;
??transform:?translateX(-50%)?translateY(-50%)?rotate(-20deg);
??position:?absolute;
??left:?50%;
??top:?50%;
}
?
.main-timeline?.timeline-icon?{
??color:?#fff;
??background-color:?#00A79B;
??font-size:?35px;
??text-align:?center;
??line-height:?50px;
??height:?50px;
??width:?50px;
??border-radius:?50%;
??transform:?translateY(-50%);
??position:?absolute;
??top:?50%;
??left:?-25px;
??transition:?all?0.3s;
}
?
.main-timeline?.title?{
??color:?#222;
??font-size:?20px;
??font-weight:?900;
??text-transform:?uppercase;
??letter-spacing:?1px;
??margin:?0?0?7px?0;
}
?
.main-timeline?.description?{
??color:?#222;
??font-size:?15px;
??letter-spacing:?1px;
??text-align:?justify;
??margin:?0?0?5px;
}
?
.main-timeline?.timeline:nth-child(even)?.timeline-content?{}
?
.main-timeline?.timeline:nth-child(even)?.timeline-content:after?{
??transform:?rotateY(180deg);
??right:?auto;
??left:?123px;
}
?
.main-timeline?.timeline:nth-child(even)?.timeline-year:after?{
??transform:?translateX(-50%)?translateY(-50%)?rotate(200deg);
}
?
.main-timeline?.timeline:nth-child(even)?.timeline-icon?{
??left:?auto;
??right:?-25px;
}
?
.timeline:nth-child(4n+2)?.timeline-content,
.timeline:nth-child(4n+2)?.timeline-year:after?{
??border-color:?#9E005D;
}
?
.timeline:nth-child(4n+2)?.timeline-year:after?{
??border-left-color:?transparent;
}
?
.timeline:nth-child(4n+2)?.timeline-content:after,
.timeline:nth-child(4n+2)?.timeline-icon,
.timeline:nth-child(4n+2)?.timeline-year?{
??background-color:?#9E005D;
}
?
.timeline:nth-child(4n+3)?.timeline-content,
.timeline:nth-child(4n+3)?.timeline-year:after?{
??border-color:?#f24f0e;
}
?
.timeline:nth-child(4n+3)?.timeline-year:after?{
??border-left-color:?transparent;
}
?
.timeline:nth-child(4n+3)?.timeline-content:after,
.timeline:nth-child(4n+3)?.timeline-icon,
.timeline:nth-child(4n+3)?.timeline-year?{
??background-color:?#f24f0e;
}
?
.timeline:nth-child(4n+4)?.timeline-content,
.timeline:nth-child(4n+4)?.timeline-year:after?{
??border-color:?#0870C5;
}
?
.timeline:nth-child(4n+4)?.timeline-year:after?{
??border-left-color:?transparent;
}
?
.timeline:nth-child(4n+4)?.timeline-content:after,
.timeline:nth-child(4n+4)?.timeline-icon,
.timeline:nth-child(4n+4)?.timeline-year?{
??background-color:?#0870C5;
}
?
@media?screen?and?(max-width:767px)?{
??.main-timeline:before?{
????display:?none;
??}
?
??.main-timeline?.timeline?{
????width:?100%;
????padding-top:?80px;
????padding-right:?12px;
????margin-bottom:?20px;
??}
?
??.main-timeline?.timeline:nth-child(even)?{
????padding-left:?10px;
????padding-top:?80px;
????margin-bottom:?20px;
??}
?
??.main-timeline?.timeline-content,
??.main-timeline?.main-timeline?.timeline:nth-child(even)?.timeline-content?{
????background-color:?#fff;
????padding-top:?25px;
??}
?
??.main-timeline?.timeline-content:after?{
????display:?none;
??}
?
??.main-timeline?.timeline-year?{
????font-size:?24px;
????line-height:?70px;
????height:?70px;
????width:?70px;
????right:?0;
????top:?-65px;
??}
?
??.main-timeline?.timeline-year:after?{
????display:?none;
??}
?
??.main-timeline?.timeline:nth-child(even)?.timeline-year?{
????left:?3px;
??}
}
?
@media?screen?and?(max-width:567px)?{
??.main-timeline?.title?{
????font-size:?18px;
??}
}
?
.swiper-container?{
??width:?205px;
??height:?500px;
??float:?left;
}
?
.swiper-slide?{
??text-align:?center;
??font-size:?18px;
??background:?#fff;
?
??/*?Center?slide?text?vertically?*/
??display:?-webkit-box;
??display:?-ms-flexbox;
??display:?-webkit-flex;
??display:?flex;
??-webkit-box-pack:?center;
??-ms-flex-pack:?center;
??-webkit-justify-content:?center;
??justify-content:?center;
??-webkit-box-align:?center;
??-ms-flex-align:?center;
??-webkit-align-items:?center;
??align-items:?center;
}
?
@media?(max-width:?760px)?{
??.swiper-button-next?{
????right:?20px;
????transform:?rotate(90deg);
??}
?
??.swiper-button-prev?{
????left:?20px;
????transform:?rotate(90deg);
??}
}
.event_list?img?{
??width:?880px;
??height:?470px;
??object-fit:?cover;
}
.xians?{
??width:?3px;
??height:?100%;
??background:?#0870C5;
??position:?absolute;
??left:?82px;
??z-index:?-1;
}

js:

??<script>
    $(function () {
      $(".main-timeline .timeline").click(function () {
        var TAG = $(this).siblings().length;
        if (TAG >= 1) {
          var index = $(this).index()
          $(this).addClass(&#39;fd-active-line&#39;).siblings().removeClass(&#39;fd-active-line&#39;)
          $(this).parent().parent().siblings(&#39;.event_list&#39;).children().eq(index).show().siblings().hide()
        }
      })
      var swiper = new Swiper(&#39;.swiper-container&#39;, {
        slidesPerView: 4,
        direction: &#39;vertical&#39;,
        navigation: {
          nextEl: &#39;.swiper-button-next&#39;,
          prevEl: &#39;.swiper-button-prev&#39;,
        },
        on: {
          resize: function () {
            swiper.changeDirection(getDirection());
          }
        }
      });
    });
  </script>
swiper使用方法

1.先載入插件,需要用到的文件有swiper-bundle.min.js和swiper-bundle.min.css文件,不同Swiper版本用到的檔名略有不同。可下載Swiper檔案或使用CDN。

<link>
<script></script>

2.HTML內(nèi)容。

<div>
	<div>
		<div>Slide?1</div>
		<div>Slide?2</div>
		<div>Slide?3</div>
	</div>
	<!-- 如果需要分頁(yè)器 -->
	<div></div>
	
	<!-- 如果需要導(dǎo)航按鈕 -->
	<div></div>
	<div></div>
	
	<!-- 如果需要滾動(dòng)條 -->
	<div></div>
</div>
導(dǎo)航等組件可以放在container之外

3.你可能想要為Swiper定義一個(gè)大小,當(dāng)然不要也行。

.swiper-container?{
????width:?600px;
????height:?300px;
}

4.初始化Swiper。 Swiper6之前的預(yù)設(shè)容器是'.swiper-container',Swiper7以後是'.swiper'。

<script>
	var mySwiper = new Swiper(&#39;.swiper-container&#39;, {
		direction: &#39;vertical&#39;, // 垂直切換選項(xiàng)
		loop: true, // 循環(huán)模式選項(xiàng)

		// 如果需要分頁(yè)器
		pagination: {
			el: &#39;.swiper-pagination&#39;,
		},

		// 如果需要前進(jìn)后退按鈕
		navigation: {
			nextEl: &#39;.swiper-button-next&#39;,
			prevEl: &#39;.swiper-button-prev&#39;,
		},

		// 如果需要滾動(dòng)條
		scrollbar: {
			el: &#39;.swiper-scrollbar&#39;,
		},
	})
</script>

5.完成。恭喜你,現(xiàn)在你的Swiper應(yīng)該已經(jīng)可以正常切換了。

如果引入CommonJs 或ES 模組

//CommonJs
var?Swiper?=?require('swiper');????
var?mySwiper?=?new?Swiper('.swiper-container',?{?/*?...?*/?});
?
//ES
import?Swiper?from?'swiper';????
var?mySwiper?=?new?Swiper('.swiper-container',?{?/*?...?*/?});

【推薦學(xué)習(xí):jQuery影片教學(xué)、web前端影片

以上是jquery+swiper實(shí)現(xiàn)時(shí)間軸tab滑動(dòng)切換顯示效果的詳細(xì)內(nèi)容。更多資訊請(qǐng)關(guān)注PHP中文網(wǎng)其他相關(guān)文章!

本網(wǎng)站聲明
本文內(nèi)容由網(wǎng)友自願(yuàn)投稿,版權(quán)歸原作者所有。本站不承擔(dān)相應(yīng)的法律責(zé)任。如發(fā)現(xiàn)涉嫌抄襲或侵權(quán)的內(nèi)容,請(qǐng)聯(lián)絡(luò)admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費(fèi)脫衣圖片

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅(qū)動(dòng)的應(yīng)用程序,用於創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費(fèi)的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費(fèi)的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強(qiáng)大的PHP整合開(kāi)發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺(jué)化網(wǎng)頁(yè)開(kāi)發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級(jí)程式碼編輯軟體(SublimeText3)

熱門(mén)話題

jQuery引用方法詳解:快速上手指南 jQuery引用方法詳解:快速上手指南 Feb 27, 2024 pm 06:45 PM

jQuery引用方法詳解:快速上手指南jQuery是一個(gè)受歡迎的JavaScript庫(kù),被廣泛用於網(wǎng)站開(kāi)發(fā)中,它簡(jiǎn)化了JavaScript編程,並為開(kāi)發(fā)者提供了豐富的功能和特性。本文將詳細(xì)介紹jQuery的引用方法,並提供具體的程式碼範(fàn)例,幫助讀者快速上手。引入jQuery首先,我們需要在HTML檔案中引入jQuery函式庫(kù)??梢酝高^(guò)CDN連結(jié)的方式引入,也可以下載

jQuery中如何使用PUT請(qǐng)求方式? jQuery中如何使用PUT請(qǐng)求方式? Feb 28, 2024 pm 03:12 PM

jQuery中如何使用PUT請(qǐng)求方式?在jQuery中,發(fā)送PUT請(qǐng)求的方法與發(fā)送其他類(lèi)型的請(qǐng)求類(lèi)似,但需要注意一些細(xì)節(jié)和參數(shù)設(shè)定。 PUT請(qǐng)求通常用於更新資源,例如更新資料庫(kù)中的資料或更新伺服器上的檔案。以下是在jQuery中使用PUT請(qǐng)求方式的具體程式碼範(fàn)例。首先,確保引入了jQuery庫(kù)文件,然後可以透過(guò)以下方式發(fā)送PUT請(qǐng)求:$.ajax({u

深度剖析:jQuery的優(yōu)勢(shì)與劣勢(shì) 深度剖析:jQuery的優(yōu)勢(shì)與劣勢(shì) Feb 27, 2024 pm 05:18 PM

jQuery是一款廣泛應(yīng)用於前端開(kāi)發(fā)的快速、小巧、功能豐富的JavaScript庫(kù)。自2006年發(fā)布以來(lái),jQuery已成為眾多開(kāi)發(fā)者的首選工具之一,但在實(shí)際應(yīng)用中,它也不乏一些優(yōu)點(diǎn)和缺點(diǎn)。本文將深度剖析jQuery的優(yōu)勢(shì)與劣勢(shì),並結(jié)合具體的程式碼範(fàn)例進(jìn)行說(shuō)明。優(yōu)點(diǎn):1.簡(jiǎn)潔的語(yǔ)法jQuery的語(yǔ)法設(shè)計(jì)簡(jiǎn)潔明了,可以大幅提升程式碼的可讀性和編寫(xiě)效率。比如,

jQuery小技巧:快速修改頁(yè)面所有a標(biāo)籤的文本 jQuery小技巧:快速修改頁(yè)面所有a標(biāo)籤的文本 Feb 28, 2024 pm 09:06 PM

標(biāo)題:jQuery小技巧:快速修改頁(yè)面所有a標(biāo)籤的文字在網(wǎng)頁(yè)開(kāi)發(fā)中,我們經(jīng)常需要對(duì)頁(yè)面中的元素進(jìn)行修改和操作。使用jQuery時(shí),有時(shí)候需要一次修改頁(yè)面中所有a標(biāo)籤的文字內(nèi)容,這樣可以節(jié)省時(shí)間和精力。以下將介紹如何使用jQuery快速修改頁(yè)面所有a標(biāo)籤的文本,同時(shí)給出具體的程式碼範(fàn)例。首先,我們需要引入jQuery庫(kù)文件,確保在頁(yè)面中引入了以下程式碼:&lt

使用jQuery修改所有a標(biāo)籤的文字內(nèi)容 使用jQuery修改所有a標(biāo)籤的文字內(nèi)容 Feb 28, 2024 pm 05:42 PM

標(biāo)題:使用jQuery修改所有a標(biāo)籤的文字內(nèi)容jQuery是一款受歡迎的JavaScript庫(kù),被廣泛用於處理DOM操作。在網(wǎng)頁(yè)開(kāi)發(fā)中,經(jīng)常會(huì)遇到需要修改頁(yè)面上連結(jié)標(biāo)籤(a標(biāo)籤)的文字內(nèi)容的需求。本文將介紹如何使用jQuery來(lái)實(shí)現(xiàn)這個(gè)目標(biāo),並提供具體的程式碼範(fàn)例。首先,我們需要在頁(yè)面中引入jQuery庫(kù)。在HTML檔案中加入以下程式碼:

jQuery如何移除元素的height屬性? jQuery如何移除元素的height屬性? Feb 28, 2024 am 08:39 AM

jQuery如何移除元素的height屬性?在前端開(kāi)發(fā)中,經(jīng)常會(huì)遇到需要操作元素的高度屬性的需求。有時(shí)候,我們可能需要?jiǎng)討B(tài)改變?cè)氐母叨?,而有時(shí)候又需要移除元素的高度屬性。本文將介紹如何使用jQuery來(lái)移除元素的高度屬性,並提供具體的程式碼範(fàn)例。在使用jQuery操作高度屬性之前,我們首先需要了解CSS中的height屬性。 height屬性用於設(shè)定元素的高度

了解jQuery中eq的作用及應(yīng)用場(chǎng)景 了解jQuery中eq的作用及應(yīng)用場(chǎng)景 Feb 28, 2024 pm 01:15 PM

jQuery是一種流行的JavaScript庫(kù),被廣泛用於處理網(wǎng)頁(yè)中的DOM操作和事件處理。在jQuery中,eq()方法是用來(lái)選擇指定索引位置的元素的方法,具體使用方法和應(yīng)用場(chǎng)景如下。在jQuery中,eq()方法選擇指定索引位置的元素。索引位置從0開(kāi)始計(jì)數(shù),即第一個(gè)元素的索引是0,第二個(gè)元素的索引是1,依此類(lèi)推。 eq()方法的語(yǔ)法如下:$("s

使用jQuery為表格新增一行的方法介紹 使用jQuery為表格新增一行的方法介紹 Feb 29, 2024 am 08:12 AM

jQuery是一個(gè)受歡迎的JavaScript函式庫(kù),廣泛用於網(wǎng)頁(yè)開(kāi)發(fā)。在網(wǎng)頁(yè)開(kāi)發(fā)過(guò)程中,經(jīng)常需要透過(guò)JavaScript動(dòng)態(tài)地在表格中新增一行。本文將介紹如何使用jQuery為表格新增一行,並提供具體的程式碼範(fàn)例。首先,我們需要在HTML頁(yè)面中引入jQuery函式庫(kù)??梢酝高^(guò)以下程式碼在標(biāo)籤中引入jQuery庫(kù):

See all articles