浅解bootstrap 下拉框插件

最近的业务需求是把后台数据渲染到前端,其中有一个是复选框数组,前端选择渲染的方式是bootstrap的下拉插件

渲染完成之后,此时会在原有select同级上面生成buton,dropdown-menu 两个块

其中框内显示的内容跟button下面的class filter-option有关,而下拉框状态显示选中却又和dropdown-menu有关,原理应该是当选中一个选项dropdown-menu ul li当前选中项增加一个class(selected),选中的这个值渲染button下面的filter-option的html值,button的title值又会等于filter-option的html值,此时如若需要渲染,只需要对应的改变三个值,

1、button的title值

2、button的儿子filter-option的html值

3、dropdown-menu ul li需要选中的addClass('selected')

为了传值方便,可以对select下方的option做一个选中处理(此处在前端无论你选择给几个赋值selected都不会真实表达出来,但是却是可以对后台取值进行帮助)

转载于:https://www.cnblogs.com/iwen1992/p/10696814.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本人花30RMB从淘宝购买的最新Color Admin1.9响应式后台模板,非常漂亮,代码完整!下面是模板预览地址! http://www.seantheme.com/color-admin-v1.9/admin/html/index.html Color Admin is the new premium and fully responsive admin template. Concept of design for Color Admin is based on the FLAT design and finally it comes out with a clean and neat design. It is built on top of the popular Bootstrap Framework. Besides that, it is bundled with a lot of third party plugins and useable elements such as buttons, thumbnails, media objects and much more... Features Built with Bootstrap 3.3.5 AJAX + HTML + ANGULAR Version 3 Front End Template 5 Admin Color Theme 2 Admin Header Theme (Black & White) 17 Admin Page Options 2 Admin Content Color Theme Local Storage Panel Modern & Old Browser Compatibility Compatible with DataTables & 9 DataTables Extension Unlimited Nav Tabs Smooth Mobile / Tablet Scrollbar Implementation Vector Icons - FontAwesome v4.4.0 Vector Icons - Simple Line Icons Vector Icons - Ionicons (700++ Icons) Fully Responsive HTML5 Markup & CSS3 JShint & HTML5 Valid Easy to understand HTML Structure, CSS Classes & Javascript markup Contrast Colors Well Documented HTML pages including: Front end - One Page Parallax (5 Theme Color) Front end - Support Forum (5 Theme Color) Front end - Blog (5 Theme Color) AJAX + HTML + ANGULAR Version Dashboard Dashboard v2 Email Email V2 Email V2 Compose Email V2 Detail General UI Elements Typography Buttons Tabs & Accordions Unlimited Nav Tabs Widget Boxes Media Object Simple Line Icons Icons Tree Views Language Bar & Icons Form Elements Form Plugins Form Validation Form Slider + Switcher Wizards Wizards + Validation WYSIWYG X-Editable Multiple File Upload Basic Table Managed Table 9 DataTables Plugins DataTables Extension Combination Flot Charts Morris Charts Chart JS Chart d3 Calendar Maps Gallery Gallery v2 Blank Page Page With Footer Page Without Sidebar Page With Right Sidebar Page With Minified Sidebar Page With Two Sidebar Page Full Height Page With Simple Line Icons Page With Ionicons Page With Light Sidebar Page With Wide Sidebar Page With Boxed Layout Page With Top Menu Page With Mixed Menu Page with Boxed Layout and Mixed Menu Page With Transparent Sidebar Search Results Invoice 404 Error Page Login Login V2 Login V3 Register V3 System Email Template Newsletter Email Template Coming Soon Page Timeline Page Profile Page Predefined CSS Classes Credits: jvectormap: http://jvectormap.com/ jQuery slimScroll: http://rocha.la/jQuery-slimScroll flot charts: http://www.flotcharts.org/ fullcalendar http://arshaw.com/fullcalendar/ Gritter: http://boedesign.com/blog/2009/07/11/growl-for-jquery-gritter/ Isotope: http://isotope.metafizzy.co/ Lightbox 2: http://lokeshdhakar.com/projects/lightbox2/ Bootstrap Datepicker: http://bootstrap-datepicker.readthedocs.org/en/release/ Bootstrap Timepicker: http://jdewit.github.io/bootstrap-timepicker/ Bootstrap Colorpicker: http://www.eyecon.ro/bootstrap-colorpicker Bootstrap ComboBox: https://github.com/danielfarrell/bootstrap-combobox Bootstrap Select: http://silviomoreto.github.io/bootstrap-select/ Masked Input: http://digitalbush.com/projects/masked-input-plugin/ Password Strength Indicator and Generator: http://benjaminsterling.com/password-strength-indicator-and-generator/ Parsley: http://parsleyjs.org/index.html Bootstrap WYSIHTML5: http://jhollingworth.github.io/bootstrap-wysihtml5/ CKEditor: http://ckeditor.com/ Bootstrap Wizard: https://github.com/gilluminate/Bootstrap-Wizard Sparkline: http://omnipotent.net/jquery.sparkline/ Table Data: http://datatables.net/blog/Twitter_Bootstrap_2 Ion Range Slider: http://ionden.com/a/plugins/ion.rangeSlider/en.html jQuery Tag It: http://aehlke.github.io/tag-it/ jQuery Countdown: http://keith-wood.name/countdown.html Zurb Email Template: http://zurb.com/ink/ jQuery Cookie: https://github.com/carhartl/jquery-cookie Switchery: http://abpetkov.github.io/switchery/ Powerange: http://abpetkov.github.io/powerange/ X-Editable: http://vitalets.github.io/x-editable/ jQuery File Upload: http://blueimp.github.io/jQuery-File-Upload/ jQuery-Knob: http://anthonyterrien.com/knob/ Simple Line Icons: http://graphicburger.com/simple-line-icons-webfont/ Morris Chart: http://morrisjs.github.io/morris.js/index.html Superbox: http://toddmotto.com/introducing-superbox-the-reimagined-lightbox-gallery/ Pace: http://github.hubspot.com/pace/ Chart JS: http://www.chartjs.org/ Flat Icon: http://iconshow.me/category/mixed/small-n-flat-icon/ In Progress FRONT END - corporate FRONT END - e-commerce UI: Sidebar Widget UI: Code Generator UI: Chatting bar UI: Extra UI Component Page with Top Navbar dashboard v3 More Plugins...
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值