Bootstrap 2.1.1“可折叠"不是第一次在 IE 中打开 [英] Bootstrap 2.1.1 "Collapsible" not opening first time in IE

查看:20
本文介绍了Bootstrap 2.1.1“可折叠"不是第一次在 IE 中打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 IE 7/8/9 中第一次点击打开 bootstrap "collapsible" 手风琴时,没有打开.还有其他人遇到过这种情况或能找出原因吗?

谢谢

<小时>

jsfiddle 演示:http://jsfiddle.net/pWU4n/7/

<div id="category-5" class="accordion-group" style="display:block;"><div class="accordion-heading"><a class="accordion-toggle" data-toggle="collapse">第一次在 IE 中打开时单击我两次</a>

<div id="category-5-accordion" class="accordion-body collapse"><div class="accordion-inner span33">Bootstrap 不仅在最新的桌面浏览器(以及 IE7!)中外观和行为都很棒!"

$(document).ready(function() {$("#category-5").click(function() {$("#category-5-accordion").collapse("toggle");});});

包括:

<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script><link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">

解决方案

这个问题与 IE 无关:这会发生在任何不支持 transitions 的浏览器上(或者如果它被停用).

那是因为你需要先初始化插件.如果你不这样做,它会在第一次点击时初始化并切换折叠:默认初始化会切换折叠 (doc),如果没有转换,折叠会连续切换两次而不会被看到.

这是你应该做的:

$("#category-5-accordion").collapse({toggle: false});$("#category-5").click(function() {$("#category-5-accordion").collapse("toggle");});

演示(jsfiddle)

The first time you click to open the bootstrap "collapsible" accordion in IE 7/8/9, it does not open. Anyone else run into this or can figure out why?

Thanks


jsfiddle demo: http://jsfiddle.net/pWU4n/7/

<div class="accordion category-list-accordion">
    <div id="category-5" class="accordion-group" style="display: block; ">
        <div class="accordion-heading">
            <a class="accordion-toggle" data-toggle="collapse">
                CLICK ME TWICE THE FIRST TIME TO OPEN IN IE
            </a>
        </div>
        <div id="category-5-accordion" class="accordion-body collapse">
            <div class="accordion-inner span33">
                "Bootstrap was made to not only look and behave great in the latest desktop browsers (as well as IE7!)"
             </div>
        </div>
    </div>
</div>

$(document).ready(function() {
    $("#category-5").click(function() {
        $("#category-5-accordion").collapse("toggle");
    });
});

<head> includes :

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/js/bootstrap.min.js"></script>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap-combined.min.css" rel="stylesheet">

解决方案

This problem is not related to IE : this will happen on any browser that doesn't support transitions (or if it is deactivated).

That's because you need to initialize the plugin first. If you don't, it both initializes and toggles the collapse on the first click : the default initialization toggles the collapse (doc), and without the transitions, the collapse is toggled twice in a row without being seen.

Here is what you should do :

$("#category-5-accordion").collapse({toggle: false});
$("#category-5").click(function() {
    $("#category-5-accordion").collapse("toggle");
});

Demo (jsfiddle)

这篇关于Bootstrap 2.1.1“可折叠"不是第一次在 IE 中打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆