嗨,大家,我想添加hoverIntent事件到我的jquery下拉菜单顶部链接,但我不知道我是如何做到这一点,请帮助下面是我从我的jQuery代码http://www.dynamicdrive.com/style/csslibrary/item/jquery_multi_level_css_menu_2/ 我无法张贴在这里的代码,请在这里签http://www.dynamicdrive.com/cssexamples/media/jqueryslidemenu.js将hoverIntent添加到jquery下拉菜单脚本
0
A
回答
0
更新为使用动态驱动的jQuery的滑动菜单:
看到这里的例子:http://jsfiddle.net/vnvQn/
在动态驾驶中slidemenu.js更改此:
$curobj.hover(
function(e) {
var $targetul = $(this).children("ul:eq(0)")
this._offsets = {
left: $(this).offset().left,
top: $(this).offset().top
}
var menuleft = this.istopheader ? 0 : this._dimensions.w
menuleft = (this._offsets.left + menuleft + this._dimensions.subulw > $(window).width()) ? (this.istopheader ? -this._dimensions.subulw + this._dimensions.w : -this._dimensions.w) : menuleft
if ($targetul.queue().length <= 1) //if 1 or less queued animations
$targetul.css({
left: menuleft + "px",
width: this._dimensions.subulw + 'px'
}).slideDown(jqueryslidemenu.animateduration.over)
}, function(e) {
var $targetul = $(this).children("ul:eq(0)")
$targetul.slideUp(jqueryslidemenu.animateduration.out)
}) //end hover
这样:
var hoverOver = function(e) {
var $targetul = $(this).children("ul:eq(0)")
this._offsets = {
left: $(this).offset().left,
top: $(this).offset().top
}
var menuleft = this.istopheader ? 0 : this._dimensions.w
menuleft = (this._offsets.left + menuleft + this._dimensions.subulw > $(window).width()) ? (this.istopheader ? -this._dimensions.subulw + this._dimensions.w : -this._dimensions.w) : menuleft
if ($targetul.queue().length <= 1) //if 1 or less queued animations
$targetul.css({
left: menuleft + "px",
width: this._dimensions.subulw + 'px'
}).slideDown(jqueryslidemenu.animateduration.over)
}
var hoverOut = function(e) {
var $targetul = $(this).children("ul:eq(0)")
$targetul.slideUp(jqueryslidemenu.animateduration.out)
} //end hover
var config = {
over: hoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: hoverOut // function = onMouseOut callback (REQUIRED)
};
$curobj.hoverIntent(config);
初始响应:
从公所Tonaka的Mega Dropdown Menu by Soh Tanaka
与HTML菜单结构像例如:
<ul id="topnav">
<li>
<a href="#" class="home">Home</a>
</li>
<li>
<a href="#" class="products">Products</a>
<div class="sub">
<ul>
<li><h2><a href="#">Desktop</a></h2></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
<li><a href="#">Navigation Link</a></li>
</ul>
</div>
...
使用jQuery,如:
function megaHoverOver(){
$(this).find(".sub").stop().fadeTo('fast', 1).show();
//Calculate width of all ul's
(function($) {
jQuery.fn.calcSubWidth = function() {
rowWidth = 0;
//Calculate row
$(this).find("ul").each(function() {
rowWidth += $(this).width();
});
};
})(jQuery);
if ($(this).find(".row").length > 0) { //If row exists...
var biggestRow = 0;
//Calculate each row
$(this).find(".row").each(function() {
$(this).calcSubWidth();
//Find biggest row
if(rowWidth > biggestRow) {
biggestRow = rowWidth;
}
});
//Set width
$(this).find(".sub").css({'width' :biggestRow});
$(this).find(".row:last").css({'margin':'0'});
} else { //If row does not exist...
$(this).calcSubWidth();
//Set Width
$(this).find(".sub").css({'width' : rowWidth});
}
}
function megaHoverOut(){
$(this).find(".sub").stop().fadeTo('fast', 0, function() {
$(this).hide();
});
}
var config = {
sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
interval: 100, // number = milliseconds for onMouseOver polling interval
over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};
$("ul#topnav li .sub").css({'opacity':'0'});
$("ul#topnav li").hoverIntent(config);
0
而写类似这样
代码3210$("#writer").find('.note, .task').hover(function() {
$(this).find('.listed').stop(true, true).doTimeout('listed', 250, 'slideDown', 'fast', 'easeInOutCubic');
}, function(){
$(this).find('.listed').stop(true, true).doTimeout('listed', 250, 'slideUp', 'fast', 'easeInOutCubic');
});
+0
请告诉我如何修改jqueryslides这个效果的菜单脚本 – Anjum 2011-03-22 16:09:42
相关问题
- 1. 将hoverIntent添加到jquery下拉菜单
- 2. 将hoverintent添加到ajax下拉菜单
- 3. 将hoverintent添加到全CSS下拉菜单
- 4. 将'animate'添加到jquery下拉菜单
- 5. 如何将JQuery缓动添加到我的简单HoverIntent菜单
- 6. 添加延迟到jquery下拉菜单
- 7. 将下拉菜单添加到magento
- 8. 将下拉菜单添加到jqGrid
- 9. 将jQuery添加到表单以显示/隐藏下拉菜单
- 10. Hoverintent - 整个菜单(Div)下拉?
- 11. 用jquery添加一个下拉菜单
- 12. 如何将下拉菜单添加到此菜单?
- 13. 将HoverIntent添加到jQuery UI选项卡
- 14. 将脚本添加到MacOS查找程序上下文菜单
- 15. 将批处理脚本添加到Windows 8上下文菜单
- 16. 水平下拉菜单使用jquery和hoverintent
- 17. javascript函数添加到下拉菜单
- 18. jQuery超级菜单hoverIntent mouseOut
- 19. 将值添加到带有表单的下拉菜单
- 20. 如何将下拉菜单添加到JTable单元
- 21. 添加第二个下拉菜单到第一个下拉菜单
- 22. jquery下拉菜单
- 23. jquery下拉菜单
- 24. 如何添加一个下拉菜单到我的菜单栏
- 25. 将下拉菜单添加到导航栏中
- 26. 将下拉菜单添加到CRM 2011功能区
- 27. 将第二层添加到此响应式下拉菜单
- 28. 将项目添加到文件中的下拉菜单
- 29. 当可见下拉菜单时,将类添加到父李a
- 30. 使用VB.NET将项目添加到功能区下拉菜单
这很酷我看到,但我只想添加hoverintent jqueryslid e.js这是滑动菜单 – Anjum 2011-03-22 16:20:19
@Anjum修改我的答案与动态驱动滑动菜单到工作... – MikeM 2011-03-22 17:05:05
感谢sooooooooooooooooooo多 – Anjum 2011-03-22 18:11:19