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 邮箱: ...
随机推荐
- JS中数据结构之图
图由边的集合及顶点的集合组成.边是有方向的是有序图(有向图),否则就是无序图(无向图).图中的一系列顶点构成路径,路径中所有的顶点都由边连接.路径的长度用路径中第一个顶点到最后一个顶点之间边的数量表示 ...
- ThinkPHP5在PHP7以上使用QueryList4, ThinkCMF在PHP5中使用QueryList3教程
QueryList 是一款用于网页采集爬虫的框架,官方最新版本为QueryList4,QueryList4版本只能在PHP7以上使用: 在PHP7以上环境中,如何在ThinkPHP5中使用QueryL ...
- TestComplete 14 百度网盘下载
TestComplete 14 百度网盘下载 链接:https://pan.baidu.com/s/1g3imm9zFOCKnx5qqtUMl4g 二维码:
- BZOJ 1369: [Baltic2003]Gem(树形dp)
传送门 解题思路 直接按奇偶层染色是错的,\(WA\)了好几次,所以要树形\(dp\),感觉最多\(log\)种颜色,不太会证. 代码 #include<iostream> #includ ...
- 获取数组NSArray元素的className
正确读取NSArray里面元素的Class类型的方法 object_getClass(columnsArray.firstObject) 错误的方法是 [columnsArray.firstObjec ...
- (转)k8s存储之NFS
转:https://www.cnblogs.com/DaweiJ/articles/9131762.html 1 NFS介绍 NFS是Network File System的简写,即网络文件系统,NF ...
- git filter-branch
https://github.com/git-for-windows/git/issues/2206 https://git-scm.com/docs/git-filter-branch The -- ...
- Maximum of lines in a DataBand
Hello! I have a problem.I have a DataBand, but I need it to grow only up to 14 lines. If it is beyon ...
- 2.tensorflow——Softmax回归
import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from tensorflow.examples. ...
- GET and POST
有待补充: