简体   繁体   English

<li>上的Bootstrap折叠打开但不会关闭

[英]Bootstrap collapse on a < li > opens but won't close

So, I am developing a vb.net website and I am using 'collapse' to toggle some parts of the page. 所以,我正在开发一个vb.net网站,我正在使用'collapse'来切换页面的某些部分。 I'm trying to use a < a > link inside a < li > list item to toggle (through href) another < li > list item. 我正在尝试使用<li>列表项中的<a>链接来切换(通过href)另一个<li>列表项。 I have multiple list items like that inside the < ul > but I only left 2 to simplify the code. 我在<ul>中有多个列表项,但我只留下2来简化代码。

Now, my problem is that the toggle and collapse work fine until I click on another link. 现在,我的问题是切换和折叠工作正常,直到我点击另一个链接。 Then if I go back to the first one, it will open but when I try to click the link to collapse it, it closes it but then re-opens it. 然后,如果我回到第一个,它将打开,但当我尝试单击链接以折叠它时,它会关闭它,但然后重新打开它。

Bootstrap.css version = 3.3.6 Bootstrap.css版本= 3.3.6
Bootstrap.js version = 4.1.3 Bootstrap.js版本= 4.1.3
Here's a part of the code: 这是代码的一部分:

<ul class="ModuleTabButton"  id="<%= ClientID & "_TabBtn"%>">
            <li class="col-md-2 col-xs-0"></li>
            <li a data-toggle="collapse"  href="#Tool_Info <span>Info</span></a></li>
            <li id="Tool_Info">
                <script>
                    function <%= ClientID%>_TInfo() {
                        ABWeb.GestionWS.LoadMagInfo('',function(arg){ $('#<%= InfoDIV.ClientID%>').html(arg)},ShowError);}                         
                </script>
            </li>
            <li class="col-md-2 col-xs-0"></li>
            <li><a data-toggle="collapse"href="#Tool_Photos"><span>Banners</span></a></li>
            <li id="Tool_Photos">
                <AP:BAN ID="MagBan" runat="server" />
                <script>
                    function <%= ClientID%>_TPhotos() {
                        GestionRefreshMagBan('<%= MagBan.ClientID%>', '');
                    } 
                </script>
            </li>  
        </ul>

I really hope this is clear enough so you can understand -___- Basically I you click on Info, the show and hide work fine. 我真的希望这很清楚,所以你可以理解-___-基本上我点击信息,节目和隐藏工作正常。 Then if you click on Banners it will still work fine for Banners but if you go back and click on Info, it will show but won't hide once you re-click it (it will try but somehow it re-opens halfway). 然后,如果你点击横幅,它仍然适用于横幅,但如果你回去点击信息,它会显示,但一旦你重新点击它将不会隐藏(它会尝试但不知何故它重新打开中途)。

Here is my bundleconfig file 这是我的bundleconfig文件

Public Class BundleConfig
' For more information on Bundling, visit http://go.microsoft.com/fwlink/?  LinkID=303951
Public Shared Sub RegisterBundles(ByVal bundles As BundleCollection)
    Dim JQVer As String = "3.3.1"
    ScriptManager.ScriptResourceMapping.AddDefinition("jquery", New ScriptResourceDefinition() With {
     .Path = "~/Scripts/jquery-" + JQVer + ".min.js",
     .DebugPath = "~/Scripts/jquery-" + JQVer + ".js",
     .LoadSuccessExpression = "window.jQuery"})

    Dim JQUIVer As String = "1.12.1"
       ScriptManager.ScriptResourceMapping.AddDefinition("jquery.ui.combined", New ScriptResourceDefinition() With {
     .Path = "~/Scripts/jquery-ui-" + JQUIVer + ".min.js",
     .DebugPath = "~/Scripts/jquery-ui-" + JQUIVer + ".js"})

    bundles.Add(New ScriptBundle("~/bundles/WebFormsJs").Include(
                    "~/Scripts/WebForms/WebForms.js",
                    "~/Scripts/WebForms/WebUIValidation.js",
                    "~/Scripts/WebForms/MenuStandards.js",
                    "~/Scripts/WebForms/Focus.js",
                    "~/Scripts/WebForms/GridView.js",
                    "~/Scripts/WebForms/DetailsView.js",
                    "~/Scripts/WebForms/TreeView.js",
                    "~/Scripts/WebForms/WebParts.js"))

    ' Order is very important for these files to work, they have explicit dependencies
    bundles.Add(New ScriptBundle("~/bundles/MsAjaxJs").Include(
            "~/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
            "~/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"))
    bundles.Add(New ScriptBundle("~/bundles/MsAjaxJs").Include(
            "~/Mag/Scripts/WebForms/MsAjax/MicrosoftAjax.js",
               "~/Mag/Scripts/WebForms/MsAjax/MicrosoftAjaxApplicationServices.js",
            "~/Mag/Scripts/WebForms/MsAjax/MicrosoftAjaxTimer.js",
            "~/Mag/Scripts/WebForms/MsAjax/MicrosoftAjaxWebForms.js"))


    bundles.Add(New ScriptBundle("~/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"))
    bundles.Add(New ScriptBundle("~/Mag/bundles/modernizr").Include(
                    "~/Scripts/modernizr-*"))


    ScriptManager.ScriptResourceMapping.AddDefinition("ckeditor", New     ScriptResourceDefinition() With {
            .Path = "~/Scripts/ckeditor.js",
            .DebugPath = "~/Scripts/ckeditor/ckeditor.js"})
    ScriptManager.ScriptResourceMapping.AddDefinition("respond", New ScriptResourceDefinition() With {
            .Path = "~/Scripts/respond.min.js",
            .DebugPath = "~/Scripts/respond.js"})

    ScriptManager.ScriptResourceMapping.AddDefinition("jQuery.FileUpload", New ScriptResourceDefinition() With {
            .Path = "~/Scripts/jQuery.FileUpload/jquery.fileupload.js",
            .DebugPath = "~/Scripts/jQuery.FileUpload/jquery.fileupload.js"})

End Sub
End Class

And heres a part of my Site.Master : 并且他是我的Site.Master的一部分:

<head>
<%--<link rel="stylesheet" type="text/css" href="~/api/Public/SiteCSS APPVER=1&TESTVER=1" />--%>
<%--<webopt:bundlereference runat="server" path="~/Content/css" />--%>
<link rel="stylesheet" type="text/css" href="~/Content/Slick/slick.css?ver=1.01" />
<link rel="stylesheet" type="text/css" href="~/Content/Slick/slick-theme.css" />
<link rel="stylesheet" type="text/css" href="~/Content/Themes/jquery-ui/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="~/Content/Themes/jquery-ui/jquery-ui.theme.css" />
<link rel="stylesheet" type="text/css" href="~/Content/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="~/Content/DynamicView.css" />
<link rel="stylesheet" type="text/css" href="~/Content/Site.css?ver=1.2" />
<link rel="stylesheet" type="text/css" href="~/css/all.min.css?ver=5.5" />
<link rel="stylesheet" type="text/css" href="~/css/font-awesome-animation.min.css" />
<link rel="stylesheet" type="text/css" href="~/Scripts/cropper/cropper.min.css" />
<link href="~/Content/Images/ABWeb.ico" rel="shortcut icon" type="image/x-icon" />
</head>
<body>
<form runat="server">
    <asp:ScriptManager runat="server" ID="MasterScript">
        <Scripts>
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="jquery.ui.combined" />       
            <asp:ScriptReference Name="jQuery.FileUpload" />
            <asp:ScriptReference Name="ckeditor" />
            <asp:ScriptReference Name="bootstrap" />
            <asp:ScriptReference Name="respond" />
            <asp:ScriptReference Name="WebFormsBundle" />
            <asp:ScriptReference Path="~/Scripts/Slick/Slick.js?V1.8" />
            <asp:ScriptReference Path="~/Scripts/cropper/cropper.min.js?V1.01" />
            <asp:ScriptReference Path="~/Scripts/jquery.lazyload.min.js?V1.8.4" />
            <asp:ScriptReference Path="~/Scripts/Helper.js?V1.01" />
            <asp:ScriptReference Path="~/Scripts/ABWeb.js?V1.07" />
            <asp:ScriptReference Path="~/Scripts/jquery.myutil.js?V1.8" />
        </Scripts>
        <Services>
            <asp:ServiceReference path="~/App_Dynamic/Master.asmx" />
            <asp:ServiceReference path="~/App_Dynamic/Public.asmx" />
        </Services>
    </asp:ScriptManager>

简单回答:停止使用崩溃!

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

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