<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
看看这个设计灵感菜单:http://theblondeabroad.com
如何使用 jQuery 正确计算这种响应式子菜单的宽度,尤其是在调整浏览器大小时?加上主容器的绝对位置(左侧和顶部),以便它保持在中心?
提前致谢。
最佳答案
jQuery 的 width()
方法将为您提供元素的计算宽度:
$(function(){
$('#menu li:has("ul")').each(function(){
alert($(this).width());
});
});
查看此链接以进一步阅读
关于jquery - 如何计算流体宽度导航菜单的正确宽度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31958169/