简体   繁体   English

获取Ul li宽度并将其设置为ul li ul的宽度

[英]Get the Ul li width and set it to the width of the ul li ul

Any way this is achievable? 有什么办法可以实现? I would think something like: 我会想这样的:

IF( hover over element ) set child element width to element width .

But I don't really know how to start with it. 但是我真的不知道如何开始。

Using JQuery: 使用JQuery:

$("#hover_elem").hover(function () {
    $(this)
        .children()
        .first()
        .width($(this).width());
});

You should probably start with a tutorial ( http://www.w3schools.com/jquery/default.asp ) in order to learn how to use JQuery. 您可能应该从教程( http://www.w3schools.com/jquery/default.asp )开始,以学习如何使用JQuery。 JQuery is easier than Javascript but this will not help you to understand how Javascript works - and so knowing jQuery does not means that you know Javascript... JQuery比Javascript容易,但这不会帮助您了解Javascript的工作原理-因此了解jQuery并不意味着您知道Javascript ...

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

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