[英]Dynamically changing an icon in Twitter Bootstrap 3
Take a look here (it uses jquery, knockoutjs, twitter bootstrap 3): 在这里看看(它使用jquery,knockoutjs,twitter引导3):
http://jsfiddle.net/NCuFy/3/ http://jsfiddle.net/NCuFy/3/
<i class="glyphicon" data-bind="click: function() { isPaused(!isPaused()) }, css: {'glyphicon-play': isPaused(), '.glyphicon-pause': !isPaused()}"></i>
var viewModel = {
isPaused: ko.observable(true),
};
ko.applyBindings(viewModel);
When I click on the play icon, the icon disappears. 当我单击播放图标时,该图标消失。 Instead, the icon should turn into pause icon.
而是,该图标应变为暂停图标。 What is wrong?
怎么了? I use the latest Chrome.
我使用最新的Chrome。
You have a .
你有一个
.
in front of your glyphicon-pause
. 在您的
glyphicon-pause
。 Remove it 去掉它
Demo: http://jsfiddle.net/tymeJV/NCuFy/4/ 演示: http : //jsfiddle.net/tymeJV/NCuFy/4/
css: {'glyphicon-play': isPaused(), '.glyphicon-pause': !isPaused()}
^ I DONT BELONG THERE!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.