jq实现跟随鼠标点击移动的下划线效果
效果如下:

1.html代码:
<div class="center-left-tap">
<a href="javascript:void (0)" style="color: #1c1c1c;" class="current" onclick="mt1()">最新</a>
<a href="javascript:void (0)" class="a-hover" onclick="mt2()">B2C</a>
<a href="javascript:void (0)" class="a-hover" onclick="mt3()">C2C</a>
<a href="javascript:void (0)" class="a-hover" onclick="mt4()">传统零售</a>
<a href="javascript:void (0)" class="a-hover" onclick="mt5()">其他</a>
</div> <!--引入下划线图片文件-->
<div class="Tab-img">
<img src="img-index/new-highline.png" alt="" id="img">
</div>
2.css代码:
.center-left-tap{height: 58px;}
.center-left-tap a{font-size: 16px;color: #999;margin-right: 37px;padding-bottom: 19px;}
.a-hover:hover{color: #595959;}
/*下化线*/
.Tab-img{position: relative}
#img{position: absolute;top: -20px;left: -7px;width: 9%;transition: all 1s;}
3.js代码:
<script>
// 选项卡下划线
var img = document.getElementById('img');
function mt1(){
img.style.left = '-7px';
}
function mt2(){
img.style.left = '50px';
}
function mt3(){
img.style.left = '120px';
}
function mt4(){
img.style.left = '210px';
}
function mt5(){
img.style.left = '300px';
}
</script>
应届菜鸟,大神勿喷...
jq实现跟随鼠标点击移动的下划线效果的更多相关文章
- 基于jQuery鼠标点击弹出登陆框效果
基于jQuery鼠标点击弹出登陆框效果.这是一款扁平样式风格的jQuery弹出层登陆框特效.效果图如下: 在线预览 源码下载 实现的代码. html代码: <input type=" ...
- 跟随鼠标指针跑的div拖拽效果
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 超强的纯 CSS 鼠标点击拖拽效果
背景 鼠标拖拽元素移动,算是一个稍微有点点复杂的交互. 而在本文,我们就将打破常规,向大家介绍一种超强的仅仅使用纯 CSS 就能够实现的鼠标点击拖拽效果. 在之前的这篇文章中 -- 不可思议的纯 CS ...
- 鼠标点击输入框文字消失 value placeholder 以及JQ实现效果 (仿京东的输入框效果)
鼠标点击输入框文字消失 value实现方法 placeholder实现方法 以及JQ实现placeholder效果 <input type="text" value ...
- jq demo 轮播图,图片可调用,向左,自动+鼠标点击切换
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content ...
- jq demo 轮播图,图片可调用,向上,自动+鼠标点击切换
1 <!doctype html> <html> <head> <meta http-equiv="Content-Type" conte ...
- jq鼠标点击滚动锚点
鼠标点击滚动锚点 //滚动锚点 $('.menus-c ul li a').click(function(){ //alert(); $('html, body').animate({ scrollT ...
- jQuery背景跟随鼠标移动的网页导航
首页 PSD模板 CSS模板 特效插件 源码下载 酷站欣赏 建站资源 建站教程 心境之旅 在线留言 设为首页 加入收藏 我要投稿 联系站长 Search 首页 PSD模板 CSS模板 特效插件 ...
- u3d 鼠标点击位置,物体移动过去。 U3d mouse clicks position, objects move past.
u3d 鼠标点击位置,物体移动过去. U3d mouse clicks position, objects move past. 作者:韩梦飞沙 Author:han_meng_fei_sha 邮箱: ...
随机推荐
- codeforces798C - Mike and gcd problem (数论+思维)
原题链接:http://codeforces.com/contest/798/problem/C 题意:有一个数列A,gcd(a1,a2,a3...,an)>1 时称这个数列是“漂亮”的.存在这 ...
- How to: Use a Custom User Name and Password Validator(WCF)
在wcf中使用自定义的用户名和密码验证方式 https://msdn.microsoft.com/en-us/library/aa702565.aspx http://www.codeproject. ...
- appium desktop 定位弹出框时报错
今天在定位真机APP的时候,弹出框的内容死活定位不到,只能定位到背景的内容. 问题:appium desktop 定位弹出框时报错,定位不到,只能定位到背景的内容. 分析: 定位工具找不到弹出框的元素 ...
- CPUID
http://en.wikipedia.org/wiki/CPUID CPUID From Wikipedia, the free encyclopedia The CPUID opcode i ...
- flysql 里两种传参的方式
传参的方式,两个标清楚: for lists_bx_goods in out_list: sql = XDO().get_update_sql('init_goods_test', { "一 ...
- xstart使用方法
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/YABIGNSHI/article/det ...
- Html5 学习笔记 【PC固定布局】 实战7 机票预订页面
最终实际效果: HTML代码: <!DOCTYPE html> <html lang="zh-cn"> <head> <meta char ...
- 开启关闭mysql服务
1.Windows下 启动服务 mysqld --console 或 net start mysql 关闭服务 mysqladmin -uroot shudown 或 net stop mysql ...
- JQuery判断radio(单选框)是否选中和获取选中值
一.设置选中方法 代码如下: $("input[name='名字']").get(0).checked=true; $("input[name='名字']"). ...
- 使用 内置函数strtok()函数实现 loadrunner 字符串替换
Action(){ /* loadrunner 字符串替换 */ char separators[] = "/"; char * token; char * file_path; ...