简体   繁体   English

HTML5自适应导航问题

[英]HTML5 responsive navigation problems

jsfiddle code here jsfiddle代码在这里

So when screen is > 580 px width, it needs to work on mouse hover, and it does. 因此,当屏幕宽度大于580像素时,它需要在鼠标悬停时工作,并且可以。 If screen is < 580 px width, you have to click on a link for it to show sub links. 如果屏幕宽度小于580像素,则必须单击链接以显示子链接。 For example, if you look at the jsfiddle code and click on portfolio the sub menu's will open, but inside those subs there are other subs, for example work has two sub menu's -> internship and freelance. 例如,如果你看的jsfiddle码并点击portfolio的子菜单的打开,但这些潜艇里面还有其他的潜艇,例如工作有两个子菜单的- >实习和自由职业者。 The problem is, in mobile view portfolio works with on click, but the sub menu's work on mouse hover, but they also need to be on click view and if you click somewhere else on the screen, they need to disappear. 问题是,在移动视图portfolio ,单击时可以使用,但是子菜单在鼠标悬停时起作用,但是它们也需要在单击视图中,如果您在屏幕上的其他位置单击,则它们需要消失。

In jQuery I have tested: 在jQuery中,我已经测试过:

if (document.documentElement.clientWidth < 580) { }

and

if (screen.width < 580) { } 

and inside these I have the .click function, but it does not work? 在这些里面我有.click函数,但是不起作用?

Can someone help me out? 有人可以帮我吗? Thanks 谢谢

Don't use JavaScript or jQuery. 不要使用JavaScript或jQuery。 Use CSS3 media quires instead. 请改用CSS3媒体资源

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM