Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
214 views
in Technique[技术] by (71.8m points)

html - (ASP.NET) How would I know that a specific menu item is being hovered over?

I'd like to make some CSS changes to a div that I have containing a ASP.NET Menu control whenever the user hovers over a specific menu selection. Right now, the div stays static, but I would like it to expand to the new hovered content.

This content and it's size will be different depending on which menu item is being hovered over, so I would need to know a specific ID associated with each item. Here's a picture example:

enter image description here

In this case, I am hovering over the "Customer Service" menu item. It expands, and shows the options under it. When I hover over this item, I would like the div containing it to expand along with it.

This menu is being populated dynamically, but here is the code for the menu control in my HTML:

<div class="box1">
    <asp:Menu ID="Menu1" runat="server" DisappearAfter="1">
        <StaticMenuStyle cssclass="Menu1"/>
    </asp:Menu>
</div>

Here is the CSS that renders this box:

.box1 {
    position: absolute;
    background-color: #B9E5BA;
    /*height: 360px;*/
    /*width: 400px;*/
    left: 50px;
    border: 5px solid #295133;
    border-radius: 0px 15px 15px 15px;
    padding-left: 20px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 20px;
}

.Menu1 li {
    padding-top: 10px;
    padding-right: 10px;
}

.Menu1 a {
    color: black;
}

I don't think I would need to provide the VB code that populates this menu, but if I do, I'll edit the question shortly with some edited code.

But yeah, I'm a little stuck at the moment. As far as I know, these all render as HTML listitem controls, which can have CSS applied to them, but I don't know that each listitem has a specific ID or anything associated with it that I can attach some CSS to.

Any help would be appreciated! Let me know if I can add any context that will help answerers.

question from:https://stackoverflow.com/questions/66052846/asp-net-how-would-i-know-that-a-specific-menu-item-is-being-hovered-over

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...