0

所以我有一个jquery Multiple Select Dropdownbox(下拉框内的复选框)
我试图实现 ,以便它看起来像一个菜单,将在提供的div上悬停时弹出。所以这是我的代码

ASP 代码:

<div class="box">
        SORT?
        <div class="hiddencolumn"  style="position: absolute; background-color:Black; height:auto;">
            <asp:DropDownList ID="CompanyDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="RegionDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="AreaDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="BranchDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="StorageGroupDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="SORDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="TicketDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="KaratDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="PORIGINDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="StatusDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="ClassificationsDropDownList" Class="s10" runat="server" AppendDataBoundItems="True">
            </asp:DropDownList>
            <br />
            <asp:Button ID="SortButton" runat="server" Text="Sort" OnClick="SortButton_Click" />
        </div>
    </div>

JavaScript For 框下拉清单和悬停淡入淡出

  <script language="javascript" type="text/javascript">
        $(document).ready(function()      
        {                 

            $(".s10").dropdownchecklist( { firstItemChecksAll: true,forceMultiple: true, onComplete: function(selector) {
                var values = "";
                for( i=0; i < selector.options.length; i++ ) {
                    if (selector.options[i].selected && (selector.options[i].value != "")) {
                        if ( values != "" ) values += ";";
                        values += selector.options[i].value;
                    }
                }
                alert( values );
            } }); 


            $(function(){
    $(".box").hover(function(){
      $(this).find(".hiddencolumn").fadeIn();
    }
                    ,function(){
                        $(this).find(".hiddencolumn").fadeOut();
                    }
                   );        
});  

   }); 
    </script>

CSS

.hiddencolumn
{
      display: none;
}

当我删除 Div 上的 Hidden 列类(例如删除display:none;)时,
渲染是正确
一个 的,如下所示:问题是当我添加hiddenColumnClass 或添加display:none到 div 时,这就是渲染

b

有什么帮助吗?或解决?任何指南将不胜感激。

4

2 回答 2

1

基于类似的问题,您可以重播您的fadeOutand fadeIn

// FadeOut with visibility : hidden
$(this).find(".hiddencolumn").fadeOut("slow", function() {
    $(this).show().css({visibility: "hidden"});
});

// FadeIn with visibility : visible
$(this).find(".hiddencolumn").hide().css({visibility: "visible"}).fadeIn("slow");

问题是display: none实际上从布局中删除了元素,因此它不再具有影响其他元素的高度或宽度,同时只需更改元素的opacity,例如 with.animate({opacity:1})使元素 100% 不透明,但元素仍然响应事件,例如鼠标点击。visibility: hidden是唯一的 CSS 规则,它呈现布局中元素的轮廓,但不会以其他方式呈现给用户。

于 2013-11-08T07:28:56.097 回答
0

max-height:0, overflow:hidden最初使用,并在悬停集上使用max-height:auto

于 2013-11-08T07:19:30.960 回答