javascript - Dynamically changing an icon in Twitter Bootstrap 3 -
take here (it uses jquery, knockoutjs, twitter bootstrap 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 click on play icon, icon disappears. instead, icon should turn pause icon. wrong? use latest chrome.
you have .
in front of glyphicon-pause
. remove it
demo: http://jsfiddle.net/tymejv/ncufy/4/
css: {'glyphicon-play': ispaused(), '.glyphicon-pause': !ispaused()} ^ dont belong there!!
Comments
Post a Comment