0

I am working on one of the asp.net project which uses Drop-down Menus from from Dynamic Drive

After using it with asp.net Menu control asp.net automatically adds styles to it. I want to replace part of CSS Style using jQuery from the following code. I would appreciate help in this regards.

<li class="" aria-haspopup="Menu1:submenu:11" role="menuitem" style="position: relative; float: left; z-index: 100;">
<a href="#?PageId=49&amp;Language=en-US" class="popout level1 static" tabindex="-1" style="padding-right: 10px;">MAIN MENU<img style="border:0;" class="downarrowclass1" src="../down.gif"></a>
    <ul class="" id="Menu1:submenu:11" style="display: none; position: absolute; top: 28px; left: 0px; visibility: visible; width: 186px;">
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=50&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU</a>
        </li>
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=52&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU/a>
        </li>
        <li role="menuitem" class="" style="position: relative;">
            <a href="#?PageId=51&amp;Language=en-US&amp;" class="level2 dynamic" tabindex="-1">SUB MENU</a>
        </li>
    </ul>
</li>

I want to change the style value of top: 28px; in UL with id="Menu1:submenu:11" to top:-58px; I am not sure how I can do.

HTML code is exact copy of asp.net web form in the browse.

I am not sure how I can reference to element with id Menu1:submenu:11 using jQuery & over right the whole style property style="display: none; position: absolute; top: 28px; left: 0px; visibility: visible; width: 186px;"

4

2 回答 2

0

一旦您知道如何,所有样式更改都很容易:

 $('#Menu1:submenu:11').css('top':-58);

有关更多详细信息,请参见此处

编辑

我刚刚看到您的问题是您无法访问选择器:$('#Menu1:submenu:11')?我建议提交另一个问题或搜索更多以找到此答案。

于 2012-12-20T11:10:13.827 回答
0
$('#Menu1:submenu:11').style.top = "-58px";
于 2012-12-20T11:10:53.543 回答