简体   繁体   English

Bootstrap面板崩溃和IE

[英]Bootstrap Panel Collapse and IE

While I have seen issues with the Bootstrap Collapse functionality in IE, this one I think is different. 虽然我已经看到IE中的Bootstrap折叠功能存在问题,但我认为这是不同的。

The thing collapses when you first click on the "Exclusively for you!" 当您第一次单击“ Exclusively for you!”时,事情崩溃了。 header, but clicking again won't open it. 标头,但再次单击将无法打开它。

I have to "store" the fact that they closed it in a session variable so I have a function in my controller to do that and it is called when the header is clicked. 我必须“存储”他们将其关闭在会话变量中的事实,因此我在控制器中有一个函数可以执行此操作,并在单击标题时调用它。 I collapse again when the page is loaded if the ShowPanel is set to "false". 如果将ShowPanel设置为“ false”,则在加载页面时再次折叠。

The window.ShowPanel variable is set from a Razor ViewBag variable: window.ShowPanel变量是从Razor ViewBag变量设置的:

<script type="text/javascript">
    $(document).ready(function () {
        window.ShowPanel = "@ViewBag.ShowPanel";
        // Initialize due to IE bug. from some SO post
        $('#collapseOne').collapse({ toggle: false });

        if (window.ShowPanel === "false") {
            $('#collapseOne').collapse('hide');
        }

        $('#panel_head').on('click', function () {
            $.ajax({
                async: true,
                type: "GET",
                url: "/Home/SetShowPanel"
            });
        })
    });
</script>

Can anyone help me figure out why IE won't re-open the section? 谁能帮我弄清楚为什么IE无法重新打开该部分?

Fiddle: http://jsfiddle.net/Mrbaseball34/wwvogjkk/ 小提琴: http : //jsfiddle.net/Mrbaseball34/wwvogjkk/

Did you mess with bootstrap.css? 您是否对bootstrap.css感到困惑? I updated bootstrap to version 2.3.2 and it works in IE. 我将引导程序更新为版本2.3.2,并且可以在IE中使用。 The collapse works in IE, but the styles are gone. 折叠在IE中有效,但是样式不见了。

http://jsfiddle.net/wwvogjkk/21/ http://jsfiddle.net/wwvogjkk/21/

$(document).ready(function () {
    window.ShowPanel = "true";
    // Initialize due to IE bug.
    $('#collapseOne').collapse({ toggle: false });

    if (window.ShowPanel === "false") {
        $('#collapseOne').collapse('hide');
    }

    $('#panel_head').on('click', function () {
        debugger;
        $.ajax({
            async: true,
            type: "GET",
            url: "/Home/SetShowPanel"
        });
    })
});

PS I didn't touch the code, it is here so that the SO would let me give you a link to latest version of the fiddle with new bootstrap referenced. PS:我没有碰过代码,就在这里,这样SO可以让我给您链接到提琴的最新版本,其中引用了新的引导程序。

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

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