Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1022736
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage).
The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by hovering "servizi", as it works properly when you try hovering "Servizi" from both "Clienti" and "Contatti".
I am pretty sure there is an option in Avada/WP to do that, or otherwise by adding some JS code, but I really have no idea how to do it!
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage).
The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by hovering "servizi", as it works properly when you try hovering "Servizi" from both "Clienti" and "Contatti".
I am pretty sure there is an option in Avada/WP to do that, or otherwise by adding some JS code, but I really have no idea how to do it!
Share Improve this question edited May 6, 2019 at 11:40 norman.lol 3,2413 gold badges30 silver badges35 bronze badges asked May 6, 2019 at 7:11 Tommaso CerciTommaso Cerci 154 bronze badges2 Answers
Reset to default 1To do that, you have to set hidden
attribute to the sub menu.
CSS
#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu {
display: none;
}
to toggle display on the menu on hover over servizi, you can add jQuery hover to the menu item.
jQuery
var subMenu = jQuery("#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu");
jQuery("#menu-item-12049").hover(function(){
subMenu.show();
}, function(){
subMenu.hide();
});
Note: You should change the class values to more appropriate values, these are just extracted from what I saw, but probably a good idea to get better css selectors
So, now it works perfectly as I would like when you hover "servizi"! The only problem is for the sub-menu single pages, where the sub-menu should remain opened always, like it did before
This is the code used currently in avada theme options:
<script>
jQuery(document).ready(function($){
var subMenu = jQuery("#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu");
jQuery("#menu-item-12049").hover(function(){
subMenu.show();
}, function(){
subMenu.hide();
});
});
</script>
Closed. This question is off-topic. It is not currently accepting answers.
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage).
The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by hovering "servizi", as it works properly when you try hovering "Servizi" from both "Clienti" and "Contatti".
I am pretty sure there is an option in Avada/WP to do that, or otherwise by adding some JS code, but I really have no idea how to do it!
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI am facing an issue in the Avada vertical menu when the homepage is opened. Please note that all "Home", "Company profile" and "Servizi" link to the same page (the homepage).
The sub-menu under "Servizi" is already opened while I would prefer it was closed by default, and that it could be opened simply by hovering "servizi", as it works properly when you try hovering "Servizi" from both "Clienti" and "Contatti".
I am pretty sure there is an option in Avada/WP to do that, or otherwise by adding some JS code, but I really have no idea how to do it!
Share Improve this question edited May 6, 2019 at 11:40 norman.lol 3,2413 gold badges30 silver badges35 bronze badges asked May 6, 2019 at 7:11 Tommaso CerciTommaso Cerci 154 bronze badges2 Answers
Reset to default 1To do that, you have to set hidden
attribute to the sub menu.
CSS
#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu {
display: none;
}
to toggle display on the menu on hover over servizi, you can add jQuery hover to the menu item.
jQuery
var subMenu = jQuery("#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu");
jQuery("#menu-item-12049").hover(function(){
subMenu.show();
}, function(){
subMenu.hide();
});
Note: You should change the class values to more appropriate values, these are just extracted from what I saw, but probably a good idea to get better css selectors
So, now it works perfectly as I would like when you hover "servizi"! The only problem is for the sub-menu single pages, where the sub-menu should remain opened always, like it did before
This is the code used currently in avada theme options:
<script>
jQuery(document).ready(function($){
var subMenu = jQuery("#wrapper .fusion-vertical-menu-widget.left .menu .sub-menu");
jQuery("#menu-item-12049").hover(function(){
subMenu.show();
}, function(){
subMenu.hide();
});
});
</script>
本文标签: javascriptHow to keep close a submenu under homepage
版权声明:本文标题:javascript - How to keep close a sub-menu under homepage? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745521248a2154324.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论