[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 /* ============================================================= 2 * bootstrap-collapse.js v2.0.1 3 * http://twitter.github.com/bootstrap/javascript.html#collapse 4 * ============================================================= 5 * Copyright 2012 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 20 !function( $ ){ 21 22 "use strict" 23 24 var Collapse = function ( element, options ) { 25 this.$element = $(element) 26 this.options = $.extend({}, $.fn.collapse.defaults, options) 27 28 if (this.options["parent"]) { 29 this.$parent = $(this.options["parent"]) 30 } 31 32 this.options.toggle && this.toggle() 33 } 34 35 Collapse.prototype = { 36 37 constructor: Collapse 38 39 , dimension: function () { 40 var hasWidth = this.$element.hasClass('width') 41 return hasWidth ? 'width' : 'height' 42 } 43 44 , show: function () { 45 var dimension = this.dimension() 46 , scroll = $.camelCase(['scroll', dimension].join('-')) 47 , actives = this.$parent && this.$parent.find('.in') 48 , hasData 49 50 if (actives && actives.length) { 51 hasData = actives.data('collapse') 52 actives.collapse('hide') 53 hasData || actives.data('collapse', null) 54 } 55 56 this.$element[dimension](0) 57 this.transition('addClass', 'show', 'shown') 58 this.$element[dimension](this.$element[0][scroll]) 59 60 } 61 62 , hide: function () { 63 var dimension = this.dimension() 64 this.reset(this.$element[dimension]()) 65 this.transition('removeClass', 'hide', 'hidden') 66 this.$element[dimension](0) 67 } 68 69 , reset: function ( size ) { 70 var dimension = this.dimension() 71 72 this.$element 73 .removeClass('collapse') 74 [dimension](size || 'auto') 75 [0].offsetWidth 76 77 this.$element.addClass('collapse') 78 } 79 80 , transition: function ( method, startEvent, completeEvent ) { 81 var that = this 82 , complete = function () { 83 if (startEvent == 'show') that.reset() 84 that.$element.trigger(completeEvent) 85 } 86 87 this.$element 88 .trigger(startEvent) 89 [method]('in') 90 91 $.support.transition && this.$element.hasClass('collapse') ? 92 this.$element.one($.support.transition.end, complete) : 93 complete() 94 } 95 96 , toggle: function () { 97 this[this.$element.hasClass('in') ? 'hide' : 'show']() 98 } 99 100 } 101 102 /* COLLAPSIBLE PLUGIN DEFINITION 103 * ============================== */ 104 105 $.fn.collapse = function ( option ) { 106 return this.each(function () { 107 var $this = $(this) 108 , data = $this.data('collapse') 109 , options = typeof option == 'object' && option 110 if (!data) $this.data('collapse', (data = new Collapse(this, options))) 111 if (typeof option == 'string') data[option]() 112 }) 113 } 114 115 $.fn.collapse.defaults = { 116 toggle: true 117 } 118 119 $.fn.collapse.Constructor = Collapse 120 121 122 /* COLLAPSIBLE DATA-API 123 * ==================== */ 124 125 $(function () { 126 $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { 127 var $this = $(this), href 128 , target = $this.attr('data-target') 129 || e.preventDefault() 130 || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 131 , option = $(target).data('collapse') ? 'toggle' : $this.data() 132 $(target).collapse(option) 133 }) 134 }) 135 136 }( window.jQuery );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |