How to create a toggle button in Bootstrap

前端 未结 10 562
自闭症患者
自闭症患者 2021-01-30 00:57

I originally created a web app in HTML, CSS and JavaScript, then was asked to create it again in Bootstrap too. I\'ve done it all fine, but I had toggle buttons in the web app t

10条回答
  •  猫巷女王i
    2021-01-30 01:28

    In case someone is still looking for a nice switch/toggle button, I followed Rick's suggestion and created a simple angular directive around it, angular-switch. Besides preferring a Windows styled switch, the total download is also much smaller (2kb vs 23kb minified css+js) compared to angular-bootstrap-switch and bootstrap-switch mentioned above together.

    You would use it as follows. First include the required js and css file:

    
    
    

    And enable it in your angular app:

    angular.module('yourModule', ['csComp'
        // other dependencies
    ]);
    

    Now you are ready to use it as follows:

    
    
    

提交回复
热议问题