0
我有一个崩溃的div,似乎无法使用我现有的jquery进行图形更改。Jquery - 单击更改Glyphicon
我想将glyphicon-plus更改为glyphicon-minus,但似乎不适用于我。
$(function(){
$('a.togglebtn').click(function(){
if($("#toggleGlyph").length !== 0)
$(".glyphicon").removeClass("glyphicon-minus").addClass("glyphicon-plus");
else if ($("#toggleGlyph").length !== 0)
$(".glyphicon").removeClass("glyphicon-plus").addClass("glyphicon-minus");
});
});
$(function(){
$('a.togglebtn').click(function(){
if($("#toggleText").text()==="Learn More"){
$("#toggleText").html("Hide");}
else {$("#toggleText").html("Learn More");}
$('#myContent').stop().slideToggle(500);
return false;
});
});
#mycontent { display:none;}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div>
<a class="lead p-color learn-button togglebtn">
<small>
<span class="glyphicon glyphicon-plus">
</span> <span id="toggleText">Learn More</span>
</small>
</a>
</div>
<div id="myContent" class="row row-offset" style="margin: 0 30px">
<div class="col-xs-6 col-md-4">
<div class="lead caption text-center">
<h3 class="h-color">Profile</h3>
</div>
<div class="thumbnail">
<img style="height: 100px; width: auto;" class="img-circle" src="images/logo-bunny.png" alt="Thumbnail">
</div>
<div class="lead caption">
<p class="p-color"><small>Some sample text. Some sample text.</small></p>
</div>
</div>
</div>
您有'if'和'其他if'相同的条件!在你的第一个例子脚本 –
我怎样才能把它们结合起来? –
任何原因不建立崩溃功能的引导程序? – Ted