You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 rivejä
2.1 KiB

  1. /* ========================================================
  2. * bootstrap-tabs.js v1.4.0
  3. * http://twitter.github.com/bootstrap/javascript.html#tabs
  4. * ========================================================
  5. * Copyright 2011 Twitter, Inc.
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. * ======================================================== */
  19. !function( $ ){
  20. "use strict"
  21. function activate ( element, container ) {
  22. container
  23. .find('> .active')
  24. .removeClass('active')
  25. .find('> .dropdown-menu > .active')
  26. .removeClass('active')
  27. element.addClass('active')
  28. if ( element.parent('.dropdown-menu') ) {
  29. element.closest('li.dropdown').addClass('active')
  30. }
  31. }
  32. function tab( e ) {
  33. var $this = $(this)
  34. , $ul = $this.closest('ul:not(.dropdown-menu)')
  35. , href = $this.attr('href')
  36. , previous
  37. , $href
  38. if ( /^#\w+/.test(href) ) {
  39. e.preventDefault()
  40. if ( $this.parent('li').hasClass('active') ) {
  41. return
  42. }
  43. previous = $ul.find('.active a').last()[0]
  44. $href = $(href)
  45. activate($this.parent('li'), $ul)
  46. activate($href, $href.parent())
  47. $this.trigger({
  48. type: 'change'
  49. , relatedTarget: previous
  50. })
  51. }
  52. }
  53. /* TABS/PILLS PLUGIN DEFINITION
  54. * ============================ */
  55. $.fn.tabs = $.fn.pills = function ( selector ) {
  56. return this.each(function () {
  57. $(this).delegate(selector || '.tabs li > a, .pills > li > a', 'click', tab)
  58. })
  59. }
  60. $(document).ready(function () {
  61. $('body').tabs('ul[data-tabs] li > a, ul[data-pills] > li > a')
  62. })
  63. }( window.jQuery || window.ender );