Bootstrap Plugin Usage Summary

Source: Internet
Author: User

Bootstrap Plugin Usage Summary

Note the bootstrap some common use of plug-ins, be sure to pay attention to the plugin version!

1. Bootstrap Switch

The switch control. Compared to the checkbox,switch will be more beautiful. Download in Bootstrap-switch, add CSS files, follow the AMD specification to introduce. js files, no longer too much to repeat.

require. config ({waitseconds:0, paths: {//Some library files jquery:'. /lib/jquery/jquery-2.1.4.min ', Bootstrap:'. /lib/bootstrap/js/bootstrap.min ', Bootstrapswitcher:'. /lib/bootstrap/plugins/switcher/js/bootstrap-switch.min ',' Bootstrapslider ':'. /lib/bootstrap/plugins/slider/bootstrap-slider.min '}, Shim: {' Bootstrap ': {deps: [' jquery '],exports:' Bootstrap '},' Bootstrapswitcher ': {deps: [' jquery '],exports:' Bootstrapswitcher '},' Bootstrapslider ': {deps: [' jquery '],exports:' Bootstrapslider '}    }});

How to use:

//html<input type="checkbox"Name="XXX"Id=""Checked>//jsrequire([' jquery ',' Bootstrap ',' Bootstrapswitcher ',' Bootstrapslider '], function($, bootstrap, Bootstrapswitcher, Bootstrapslider){$ (document). Ready ( function(){        //Initialize switch$("[type= ' checkbox ']"). Bootstrapswitch ();//Register Switchchange event, note suffix$(' input[type= ' checkbox "] '). On (' Switchchange.bootstrapswitch ', function(event, state){            varDomid = This. ID;//dom ID            varDomclass = This. className;//classnameConsole.log ( This);//DOM elementsConsole.log (event);//jquery EventsConsole.log (state);//true | false}); });})

Other configuration items and event descriptions see: http://www.bootstrap-switch.org/

2. Bootstrap Slider

Slide Bar. : Https://github.com/seiyria/bootstrap-slider, here is a very detailed description. As with the switch plugin, add CSS styles and corresponding. js files.

2.1 Options
name type Default Value Description
Id String “” Slider Element ID
Min Float 0 Minimum value
Max Float 10 Maximum Value
Step Float 1 Growth step
2.2 methods2.3 Events

Examples of Use:

//html <Input ID="Temp" type="Text" Data-slider-min="0" Data-slider-max=" the" Data-slider-step="1" Data-slider-value="+"> //js$(' #temp ').Slider ({formatter:function (value) {return ' temp: ' +Value        }        }); $("#temp"). on("Slide", function (SLIDEEVT) {varTemp=Slideevt.Value });

Bootstrap Plugin Usage Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.