[英]jquery mega drop down menu plugin (dcMegaMenu) how to change event hover to click on window resize
jquery mega drop down menu plugin: ( http://www.designchemical.com/lab/jquery-mega-drop-down-menu-plugin/advanced-styling/ ) jquery mega下拉菜单插件:( http://www.designchemical.com/lab/jquery-mega-drop-down-menu-plugin/advanced-styling/ )
Hi Guys, I am working on a responsive website using jquery mega drop down menu plugin by http://www.designchemical.com . 嗨,大家好,我正在使用http://www.designchemical.com的 jquery mega下拉菜单插件在一个响应式网站上工作。
On desktop, by default full width windows (above 980px width) I am using event: "hover" in the plugin option. 在台式机上,默认情况下,全角窗口(宽度大于980px)在插件选项中使用事件:“ hover”。 But I need a solution on how to change to event: "click" when window size is below 980px width?
但是我需要一个如何更改为事件的解决方案:当窗口大小低于980px宽度时“单击”?
Hope to find a solutions here. 希望在这里找到解决方案。 Many thanks!
非常感谢!
try this lines: 尝试以下行:
jQuery(document).ready(function($) {
if($(window).width() < 980){
jQuery('#mega-menu').dcMegaMenu({
event: 'click'
});
}
});
Or on window resize: 或在窗口调整大小时:
jQuery(window).resize(function($) {
if($(window).width() < 980){
jQuery('#mega-menu').dcMegaMenu({
event: 'click'
});
}
});
Good luck! 祝好运!
$('#mega-menu-1').dcMegaMenu({
rowItems: '3',
speed: 600,
effect: 'slide',
event: 'click'
});
event:'click' works only with horizontal mega menu.There is no option for click in vertical mega menu. event:'click'仅适用于水平大型菜单。垂直mega菜单中没有单击选项。
1) Create a function to init the megamenu, depending on width (for this case, if width is more than 966px, the megamenu will be initiated) 1)创建一个函数来初始化megamenu,具体取决于宽度(在这种情况下,如果宽度大于966px,将启动megamenu)
function init_megamenu() {
var w = $(window).width();
if (w >= 966) {
$('#mega-menu-9').dcMegaMenu({
rowItems: '3',
speed: 'fast',
effect: 'fade'
});
}
}
2) Call the init_megamenu() function on document ready and window resize 2)在准备好文档并调整窗口大小时调用init_megamenu()函数
$(document).ready(function() {
// desktop menu
init_megamenu();
});
$(window).resize(function() {
// desktop menu
init_megamenu();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.