web299.com
全部
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
首页
教育
语言/资格考试
法律
互联网
政务民生
Word模板
Excel模板
PPT模板
网页特效
小程序模板
网站模板
当前位置:
首页
>
网页特效
>
选项卡
jQuery和CSS3超酷Material Design风格滑动选项卡特效
分类:
选项卡
日期:
2024-05-14
点击(2)
评论(0)
演 示
免费下载
简介
#### 使用方法 ##### HTML结构 TAB选项卡使用一个无序列表来制作。 ```html
Tab One
Tab Two
Tab Three
``` ##### CSS样式 TAB选项卡的基本样式如下: ```html ul { font-size: 0; position: relative; padding: 0; width: 480px; margin: 40px auto; user-select: none; } li { display: inline-block; width: 160px; height: 60px; background: #E95546; font-size: 16px; text-align: center; line-height: 60px; color: #fff; text-transform: uppercase; position: relative; overflow: hidden; cursor: pointer; } ``` 下面是每一个选项卡按钮下面的滑动线条的样式: ```html .slider { display: block; position: absolute; bottom: 0; left: 0; height: 4px; background: #4FC2E5; transition: all 0.5s; } ``` 接下来使用CSS3 animations来创建按钮点击波效果。 ```html .ripple { width: 0; height: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.4); -webkit-transform: scale(0); -ms-transform: scale(0); transform: scale(0); position: absolute; opacity: 1; } .rippleEffect { -webkit-animation: rippleDrop .6s linear; animation: rippleDrop .6s linear; } @-webkit-keyframes rippleDrop { 100% { -webkit-transform: scale(2); transform: scale(2); opacity: 0; } } @keyframes rippleDrop { 100% { -webkit-transform: scale(2); transform: scale(2); opacity: 0; } } ``` ##### JAVASCRIPT 整个Material Design风格的选项卡特效的互动使用下面的jQuery代码: ```html $("ul li").click(function(e) { if ($(this).hasClass('slider')) { return; } var whatTab = $(this).index(); var howFar = 160 * whatTab; $(".slider").css({ left: howFar + "px" }); $(".ripple").remove(); var posX = $(this).offset().left, posY = $(this).offset().top, buttonWidth = $(this).width(), buttonHeight = $(this).height(); $(this).prepend("
"); if (buttonWidth >= buttonHeight) { buttonHeight = buttonWidth; } else { buttonWidth = buttonHeight; } var x = e.pageX - posX - buttonWidth / 2; var y = e.pageY - posY - buttonHeight / 2; $(".ripple").css({ width: buttonWidth, height: buttonHeight, top: y + 'px', left: x + 'px' }).addClass("rippleEffect"); }); ```
相关推荐
html5浪漫粒子表白文字特效
SlidesJS幻灯片特效
html5瀑布流相册特效
css3 svg实现的情人节表白鲜花动画特效
t-scroll.js基于ES6的DOM元素,过渡动画库插件
纯js写省市区三级联动效果
广告
广告