简要教程
这是一款使用jQuery和CSS3动画制作的炫酷响应式TAB选项卡样式幻灯片特效。该幻灯片特效采用TAB选项卡来进行切换,每次切换时slide中的元素都带有非常炫酷的CSS3动画效果。
查看演示 下载插件
浏览器兼容性
使用方法
HTML结构
该TAB样式幻灯片的基本HTML结构如下:
<div class="tabSlider"> <div class="ts-items"> <!-- 单个slide --> <div class="ts-item is-active"> <div class="ts-banner"> <!-- 背景图片 --> <img src="/static/imghwm/default1.png" data-src="bg1.jpg" class="lazy" alt="alt goes here" /> </div> <div class="ts-container set-layout thumb-cont"> <div class="ts-thumbnail"> <img src="/static/imghwm/default1.png" data-src="img1.png" class="lazy" alt="alt" /> </div> <div class="ts-content"> <div class="ts-title"> 标题 </div> <a href="" class="ts-btn pull-right set-icon to-right"> <span>文本内容</span> </a> </div> </div> </div> <!-- 单个slide --> ...... </div> <!--tab选项卡--> <nav class="ts-control"> <div class="ts-container"> <ul> <li class="is-active"><i class="ts-icon auto"></i> <span>Slide 1</span></li> <li><i class="ts-icon medical"></i> <span>Slide 2</span></li> <li><i class="ts-icon food"></i> <span>Slide 3</span></li> </ul> </div> </nav></div>
CSS样式
在切换TAB选项卡时,通过jQuery代码为当前的slide动态添加.is-activeclass。这个class类会为.ts-item元素下的缩略图、文本内容和按钮子元素分别添加CSS3动画。
.tabSlider .ts-items .ts-item.is-active { background-position: center center;}.tabSlider .ts-items .ts-item.is-active .ts-thumbnail img { -webkit-animation-name: vanishIn; -moz-animation-name: vanishIn; -ms-animation-name: vanishIn; -o-animation-name: vanishIn; animation-name: vanishIn;}.tabSlider .ts-items .ts-item.is-active .ts-title { -webkit-animation-name: presRIn; -moz-animation-name: presRIn; -ms-animation-name: presRIn; -o-animation-name: presRIn; animation-name: presRIn;}.tabSlider .ts-items .ts-item.is-active .ts-btn { -webkit-animation-name: button; -moz-animation-name: button; -ms-animation-name: button; -o-animation-name: button; animation-name: button;}/* vanishIn动画 */@keyframes vanishIn { 0% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: scale(2); -ms-transform: scale(2); -webkit-transform: scale(2); transform: scale(2); -webkit-filter: blur(10px); filter: blur(10px); } 100% { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: scale(1); -ms-transform: scale(1); -webkit-transform: scale(1); transform: scale(1); -webkit-filter: blur(0px); filter: blur(0px); }}/* button动画 */@keyframes button { 0% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; left: -90px; } 100% { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; left: 0; }}/* presRIn动画 */@keyframes presRIn { 0% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); opacity: 0; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(0.3, 0.3) rotateY(90deg); -ms-transform: perspective(600) scale(0.3, 0.3) rotateY(90deg); -webkit-transform: perspective(600) scale(0.3, 0.3) rotateY(90deg); transform: perspective(600) scale(0.3, 0.3) rotateY(90deg); } 60% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=40); opacity: 0.4; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(0.7, 0.7) rotateY(0deg); -ms-transform: perspective(600) scale(0.7, 0.7) rotateY(0deg); -webkit-transform: perspective(600) scale(0.7, 0.7) rotateY(0deg); transform: perspective(600) scale(0.7, 0.7) rotateY(0deg); } 70% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=70); opacity: 0.7; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(1, 1) rotateY(10deg); -ms-transform: perspective(600) scale(1, 1) rotateY(10deg); -webkit-transform: perspective(600) scale(1, 1) rotateY(10deg); transform: perspective(600) scale(1, 1) rotateY(10deg); } 75% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); opacity: 0.8; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(1, 1) rotateY(-10deg); -ms-transform: perspective(600) scale(1, 1) rotateY(-10deg); -webkit-transform: perspective(600) scale(1, 1) rotateY(-10deg); transform: perspective(600) scale(1, 1) rotateY(-10deg); } 90% { filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=90); opacity: 0.9; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(1, 1) rotateY(5deg); -ms-transform: perspective(600) scale(1, 1) rotateY(5deg); -webkit-transform: perspective(600) scale(1, 1) rotateY(5deg); transform: perspective(600) scale(1, 1) rotateY(5deg); } 100% { filter: progid:DXImageTransform.Microsoft.Alpha(enabled=false); opacity: 1; -moz-transform-origin: 50% 50%; -ms-transform-origin: 50% 50%; -webkit-transform-origin: 50% 50%; transform-origin: 50% 50%; -moz-transform: perspective(600) scale(1, 1) rotateY(0deg); -ms-transform: perspective(600) scale(1, 1) rotateY(0deg); -webkit-transform: perspective(600) scale(1, 1) rotateY(0deg); transform: perspective(600) scale(1, 1) rotateY(0deg); }}
CSS样式中还使用媒体查询来制作响应式效果,完整的CSS代码请参考style.css文件。
JAVASCRIPT
该TAB选项卡幻灯片特效使用jQuery来控制背景图片和tab选项卡切换时的事件,为相应的幻灯片slide添加和移除相应的class。
$(function(){ $('a').on('click', function(){ return false; }); $('.ts-item').first().show(); $('.ts-item').each(function () { var $this = $(this), _imgSrc = $this.find('.ts-banner img').attr('src'); if(_imgSrc) $this.css('background-image', 'url(' + _imgSrc + ')'); }); $('.ts-control li').on('click', function(){ var $this = $(this), _index = $this.index(); $("li.is-active").removeClass("is-active"); $(this).addClass("is-active"); $('.ts-item.is-active').removeClass('is-active').fadeOut(); $('.ts-item').eq(_index).addClass('is-active').fadeIn(); return false; }); var ww = $(window).width(); });
来源:jQuery之家

The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)
