JQuery Delay Hover效果
CSS代码
.tbui_aside_float_bar
{
position: fixed;
left: 50%;
bottom: 120px;
margin-left: 608px;
border-top: 1px solid #e5e5e5;
z-index: 11;
_position: absolute;
_top: expression(documentElement.scrollTop+documentElement.clientHeight - this.offsetHeight-100);
}
.tbui_aside_float_bar li a
{
display: block;
width: 55px;
height: 55px;
background: url(/image/sidebar.png) no-repeat;
outline: 0;
}
.tbui_aside_float_bar li.tbui_fbar_fav a:hover
{
background-position: -55px 0px;
}
.tbui_aside_float_bar li.tbui_fbar_fav a
{
}
.tbui_aside_float_bar li.tbui_fbar_share a:hover
{
background-position: -55px -55px;
}
.tbui_aside_float_bar li.tbui_fbar_share a
{
background-position: 0 -55px;
}
.tbui_aside_float_bar li.tbui_fbar_top a:hover
{
background-position: -55px -110px;
}
.tbui_aside_float_bar li.tbui_fbar_top a
{
background-position: 0 -110px;
}
HTML代码
<div class="sidebar">
<div id="hoverDiv" class="hoverDiv" style="position: absolute; display: block;border: 1px solid #e9e9e9;">
<div class="hoverDivConent">
<h6 style="background-color: #f6f6f6; text-align:right;">
为您服务</h6>
<ul>
<li>1号</li>
<li>2号</li>
<li>3号</li>
</ul>
</div>
</div>
<ul class="tbui_aside_float_bar"> <li class="tbui_aside_fbar_button tbui_fbar_share"><a id="share" class="hover_button"
href="#"></a></li>
</ul>
</div>
JAVAScript
<script type="text/javascript">
$(document).ready(function () { $.fn.queueInterruptibleAction = function (delayMilseconds, actionCallback) {
//cancel if other action exist
this.cancelInterruptibleAction();
// delay execute delayCallback
var timerId = window.setTimeout(function () {
$.removeData(this, 'timerId');
actionCallback.call(this);
}, delayMilseconds);
$.data(this, 'timerId', timerId);
}; $.fn.cancelInterruptibleAction = function () {
var timerId = $.data(this, 'timerId');
if (timerId != null) {
$.removeData(this, 'timerId');
window.clearTimeout(timerId);
}
}; //tClass=TargetClass,pClass=ParentClass
$.fn.delayHover = function (tClass, pClass, enterDelay, leaveDelay) {
if (enterDelay == null) enterDelay = 150;
if (leaveDelay == null) leaveDelay = 400;
return this.each(function () {
var trigger = $(this); //button
var target = $(this).closest(pClass).find(tClass); //view trigger.mouseenter(function () {
x = trigger.offset();
target.css("left", x.left - 100);
target.css("top", x.top + 2);
target.queueInterruptibleAction(enterDelay, function () {
target.fadeIn();
});
});
trigger.mouseleave(function () {
target.queueInterruptibleAction(leaveDelay, function () {
target.fadeOut();
});
});
target.mouseenter(function () {
target.cancelInterruptibleAction();
});
target.mouseleave(function () {
target.queueInterruptibleAction(leaveDelay, function () {
target.hide();
});
});
});
}; $('.hover_button').delayHover('.hoverDiv', '.sidebar', 150, 400);
}); //end of document.ready </script>
JQuery Delay Hover效果的更多相关文章
- jQuery怎么去掉标签的hover效果
今天项目中遇到jquery去掉hover效果的问题,开始以为直接unbind(“hover”)就可以搞定,可是实际验证这个方法并没有作用,正确的使用方法应该是下面这样: /* 这种方法是新增的,在老的 ...
- JQuery实现广告效果(滚动切换)
JQuery实现广告效果(滚动切换) Html+css 效果如上图 代码: <!DOCTYPE html> <html> <head lang="en&qu ...
- jQuery之动画效果show()......animate()
jQuery之动画效果 1.show()显示效果 语法:show(speed,callback) Number/String,Function speend为动画执行时间,单位为毫秒.也可以为slow ...
- jquery live hover事件的替代写法
HTML中的hover行为通常在样式中定义,利用jquery实现此效果有两种情况. 第一种是常见的针对页面中静态的元素,以改变元素样式中的border-color为例,写法如下: $(function ...
- jquery特效 幻灯片效果
jquery特效 幻灯片效果,效果图如下: <!DOCTYPE html> <html> <head> <meta http-equiv="Cont ...
- 使用jquery实现放大镜效果
原文:使用jquery实现放大镜效果 实现原理 首先,我们讲解一下放大镜效果的实现方式: 方法一:准备一张高像素的大图,当鼠标放到原图上,加载显示大图的对应位置. 方法二:对原图片进行放大,也就是调整 ...
- jQuery的hover方法搭配css的hover选择器,实现选中元素突出显示
问题简述: 今天做帮一个师姐做网页遇到一个这样的要求: 鼠标不移动进表格,表格透明度不变. 鼠标移动进表格,hover到的单元格透明度不变,没hover到的单元格透明度改变. 先贴我已经实现好的效果, ...
- jQuery操作之效果
jQuery操作之效果 效果操作一共分五类:1.基本,2.滑动,3.淡入淡出,4.自定义,5.设置 show(),hide(),toggle() 代码如下: html代码: <p style=& ...
- jQuery中hover与mouseover和mouseout的区别分析
本文实例分析了jQuery中hover与mouseover和mouseout的区别.分享给大家供大家参考,具体如下: 以前一直以为在jquery中其实mouseover和mouseout两个事件等于h ...
随机推荐
- UDP 构建p2p打洞过程的实现原理(持续更新)
UDP 构建p2p打洞过程的实现原理(持续更新) 发表于7个月前(2015-01-19 10:55) 阅读(433) | 评论(0) 8人收藏此文章, 我要收藏 赞0 8月22日珠海 OSC 源创 ...
- Yii源码阅读笔记(十二)
Action类,控制器中方法的基类: namespace yii\base; use Yii; /** * Action is the base class for all controller ac ...
- NERDTree 快捷键辑录
参看连接:http://www.cnblogs.com/lexus/archive/2012/11/04/2753187.html http://yang3wei.github.io/blog/201 ...
- jwplayer直播
<div class='container'> <div class='row'> <div class='col-sm-10 col-md-10 col-sm-offs ...
- Programming In hardware Programming in software
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION
- Advanced Packaging Tool
https://en.wikipedia.org/wiki/Advanced_Packaging_Tool Eventually, a new team picked up the project, ...
- [转]C#之反射
前言 之所以要写这篇关于C#反射的随笔,起因有两个: 第一个是自己开发的网站需要用到 其次就是没看到这方面比较好的文章. 所以下定决心自己写一篇,废话不多说开始进入正题. 前期准备 在VS20 ...
- 超简单的处理JSON格式和JSON数组格式的String
现在网站上有不少处理JSON格式的工具类,但是我找了一天,发现大都是需要编写相应对象类来进行处理,比较麻烦,比如:Gson,json-lib.Gson,json-lib这些处理那些接口之类的参数名字和 ...
- strcpy之代码的健壮性与可维护性
strcpy 函数的原型是: char * strcpy(char * strDest,const char * strSrc); 功能:把从strSrc地址开始且含有NULL结束符的字符串 ...
- [LeetCode]题解(python):101 Symmetric tree
题目来源 https://leetcode.com/problems/symmetric-tree/ Given a binary tree, check whether it is a mirror ...