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 ...
随机推荐
- node.js 初体验
node.js 初体验 2011-10-31 22:56 by 聂微东, 174545 阅读, 118 评论, 收藏, 编辑 PS: ~ 此篇文章的进阶内容在为<Nodejs初阶之express ...
- 10 位顶级 PHP 大师的开发原则
10 位顶级 PHP 大师的开发原则 ruby_chen 发布于: 2013年03月28日 (61评) 分享到: 收藏 +139 #深圳# 6月10日 亚马逊AWSome Day云计算免费培训报 ...
- laravel 视图组件
假设有一个文件被多个视图需要,比如导航条: 1.在路由文件添加 View::composer('stats', function($view){ $view->with('stats', app ...
- Map的数据结构
一:Map<String,Map<String,Map<String,List<A>>>>
- git 第一次初始化
Command line instructions Git global setup git config --global user.name "{名字}({工号})" git ...
- sqlserver 通过convert取得指定格式的时间
http://msdn.microsoft.com/zh-cn/library/ms187928(v=sql.105).aspx CONVERT(NVARCHAR(10),Created,112) 不 ...
- centos常用命令
应用程序->附件->终端 一:使用CentOS常用命令查看cpumore /proc/cpuinfo | grep "model name" grep " ...
- Android源码剖析之Framework层升级版(窗口、系统启动)
本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处! 看本篇文章之前,建议先查看: Android源码剖析之Framework层基础版 前面讲了frame ...
- Qt通过QToolTip显示浮动信息
QToolTip类的应用十分简单,其QToolTip类中全都是静态方法,如果要显示浮动信息的话使用该函数即可: void QToolTip::showText ( const QPoint & ...
- 371. Sum of Two Integers
不用加减法计算两个整数的和.这道题其实是考察一些基本的布尔代数知识.我们知道,二进制表示时: 0 + 0 = 00 1 + 0 = 01 0 + 1 = 01 1 + 1 = 10 所以,两个二进制整 ...