Skip to content

Commit 6190e5f

Browse files
Updated distribution to version 1.11.2
1 parent 1a8dded commit 6190e5f

136 files changed

Lines changed: 617 additions & 402 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

components/accordion.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* # Semantic UI 1.11.0 - Accordion
2+
* # Semantic UI 1.11.2 - Accordion
33
* http://github.com/semantic-org/semantic-ui/
44
*
55
*
@@ -144,7 +144,7 @@
144144
transition: background 0.2s ease, color 0.2s ease;
145145
}
146146
.ui.styled.accordion > .title:first-child,
147-
.ui.styled.accordion > .accordion .title:first-child {
147+
.ui.styled.accordion .accordion .title:first-child {
148148
border-top: none;
149149
}
150150

components/accordion.js

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* # Semantic UI 1.11.0 - Accordion
2+
* # Semantic UI 1.11.2 - Accordion
33
* http://github.com/semantic-org/semantic-ui/
44
*
55
*
@@ -61,10 +61,8 @@ $.fn.accordion = function(parameters) {
6161
module = {
6262

6363
initialize: function() {
64-
module.debug('Initializing accordion with bound events', $module);
65-
$module
66-
.on('click' + eventNamespace, selector.title, module.event.click)
67-
;
64+
module.debug('Initializing', $module);
65+
module.bind.events();
6866
module.observeChanges();
6967
module.instantiate();
7068
},
@@ -77,12 +75,10 @@ $.fn.accordion = function(parameters) {
7775
},
7876

7977
destroy: function() {
80-
module.debug('Destroying previous accordion for', $module);
78+
module.debug('Destroying previous instance', $module);
8179
$module
82-
.removeData(moduleNamespace)
83-
;
84-
$title
8580
.off(eventNamespace)
81+
.removeData(moduleNamespace)
8682
;
8783
},
8884

@@ -105,6 +101,14 @@ $.fn.accordion = function(parameters) {
105101
}
106102
},
107103

104+
bind: {
105+
events: function() {
106+
module.debug('Binding delegated events');
107+
$module
108+
.on('click' + eventNamespace, selector.trigger, module.event.click)
109+
;
110+
}
111+
},
108112

109113
event: {
110114
click: function() {
@@ -117,13 +121,16 @@ $.fn.accordion = function(parameters) {
117121
$activeTitle = (query !== undefined)
118122
? (typeof query === 'number')
119123
? $title.eq(query)
120-
: $(query)
121-
: $(this),
124+
: $(query).closest(selector.title)
125+
: $(this).closest(selector.title),
122126
$activeContent = $activeTitle.next($content),
123-
contentIsOpen = $activeContent.is(':visible')
127+
isAnimating = $activeContent.hasClass(className.animating),
128+
isActive = $activeContent.hasClass(className.active),
129+
isOpen = (isActive && !isAnimating),
130+
isOpening = (!isActive && isAnimating)
124131
;
125132
module.debug('Toggling visibility of content', $activeTitle);
126-
if(contentIsOpen) {
133+
if(isOpen || isOpening) {
127134
if(settings.collapsible) {
128135
module.close.call($activeTitle);
129136
}
@@ -132,7 +139,7 @@ $.fn.accordion = function(parameters) {
132139
}
133140
}
134141
else {
135-
module.open.call($activeTitle);
142+
module.open.call($activeTitle);
136143
}
137144
},
138145

@@ -141,47 +148,51 @@ $.fn.accordion = function(parameters) {
141148
$activeTitle = (query !== undefined)
142149
? (typeof query === 'number')
143150
? $title.eq(query)
144-
: $(query)
145-
: $(this),
146-
$activeContent = $activeTitle.next($content),
147-
currentlyAnimating = $activeContent.is(':animated'),
148-
currentlyActive = $activeContent.hasClass(className.active)
151+
: $(query).closest(selector.title)
152+
: $(this).closest(selector.title),
153+
$activeContent = $activeTitle.next($content),
154+
isAnimating = $activeContent.hasClass(className.animating),
155+
isActive = $activeContent.hasClass(className.active),
156+
isUnopen = (!isActive && !isAnimating)
149157
;
150-
if(!currentlyAnimating && !currentlyActive) {
158+
if(isUnopen) {
151159
module.debug('Opening accordion content', $activeTitle);
152160
if(settings.exclusive) {
153161
module.closeOthers.call($activeTitle);
154162
}
155163
$activeTitle
156164
.addClass(className.active)
157165
;
166+
$activeContent.addClass(className.animating);
158167
if(settings.animateChildren) {
159168
if($.fn.transition !== undefined && $module.transition('is supported')) {
160169
$activeContent
161170
.children()
162171
.transition({
163-
animation : 'fade in',
172+
animation : 'fade in',
173+
queue : false,
164174
useFailSafe : true,
165-
debug : settings.debug,
166-
verbose : settings.verbose,
167-
duration : settings.duration
175+
debug : settings.debug,
176+
verbose : settings.verbose,
177+
duration : settings.duration
168178
})
169179
;
170180
}
171181
else {
172182
$activeContent
173183
.children()
174-
.stop()
184+
.stop(true)
175185
.animate({
176186
opacity: 1
177187
}, settings.duration, module.resetOpacity)
178188
;
179189
}
180190
}
181191
$activeContent
182-
.stop()
192+
.stop(true)
183193
.slideDown(settings.duration, settings.easing, function() {
184194
$activeContent
195+
.removeClass(className.animating)
185196
.addClass(className.active)
186197
;
187198
module.reset.display.call(this);
@@ -197,26 +208,29 @@ $.fn.accordion = function(parameters) {
197208
$activeTitle = (query !== undefined)
198209
? (typeof query === 'number')
199210
? $title.eq(query)
200-
: $(query)
201-
: $(this),
211+
: $(query).closest(selector.title)
212+
: $(this).closest(selector.title),
202213
$activeContent = $activeTitle.next($content),
203-
isActive = $activeContent.hasClass(className.active)
214+
isAnimating = $activeContent.hasClass(className.animating),
215+
isActive = $activeContent.hasClass(className.active),
216+
isOpening = (!isActive && isAnimating),
217+
isClosing = (isActive && isAnimating)
204218
;
205-
if(isActive) {
219+
if((isActive || isOpening) && !isClosing) {
206220
module.debug('Closing accordion content', $activeContent);
207221
$activeTitle
208222
.removeClass(className.active)
209223
;
210224
$activeContent
211-
.removeClass(className.active)
212-
.show()
225+
.addClass(className.animating)
213226
;
214227
if(settings.animateChildren) {
215228
if($.fn.transition !== undefined && $module.transition('is supported')) {
216229
$activeContent
217230
.children()
218231
.transition({
219232
animation : 'fade out',
233+
queue : false,
220234
useFailSafe : true,
221235
debug : settings.debug,
222236
verbose : settings.verbose,
@@ -227,16 +241,20 @@ $.fn.accordion = function(parameters) {
227241
else {
228242
$activeContent
229243
.children()
230-
.stop()
244+
.stop(true)
231245
.animate({
232246
opacity: 0
233247
}, settings.duration, module.resetOpacity)
234248
;
235249
}
236250
}
237251
$activeContent
238-
.stop()
252+
.stop(true)
239253
.slideUp(settings.duration, settings.easing, function() {
254+
$activeContent
255+
.removeClass(className.animating)
256+
.removeClass(className.active)
257+
;
240258
module.reset.display.call(this);
241259
settings.onClose.call(this);
242260
settings.onChange.call(this);
@@ -249,7 +267,7 @@ $.fn.accordion = function(parameters) {
249267
var
250268
$activeTitle = (index !== undefined)
251269
? $title.eq(index)
252-
: $(this),
270+
: $(this).closest(selector.title),
253271
$parentTitles = $activeTitle.parents(selector.content).prev(selector.title),
254272
$activeAccordion = $activeTitle.closest(selector.accordion),
255273
activeSelector = selector.title + '.' + className.active + ':visible',
@@ -524,8 +542,8 @@ $.fn.accordion.settings = {
524542
closeNested : false,
525543
animateChildren : true,
526544

527-
duration : 500,
528-
easing : 'easeOutQuint',
545+
duration : 350,
546+
easing : 'easeOutQuad',
529547

530548
onOpen : function(){},
531549
onClose : function(){},
@@ -536,21 +554,23 @@ $.fn.accordion.settings = {
536554
},
537555

538556
className : {
539-
active : 'active'
557+
active : 'active',
558+
animating : 'animating'
540559
},
541560

542561
selector : {
543562
accordion : '.accordion',
544563
title : '.title',
564+
trigger : '.title',
545565
content : '.content'
546566
}
547567

548568
};
549569

550570
// Adds easing
551571
$.extend( $.easing, {
552-
easeOutQuint: function (x, t, b, c, d) {
553-
return c*((t=t/d-1)*t*t*t*t + 1) + b;
572+
easeOutQuad: function (x, t, b, c, d) {
573+
return -c *(t/=d)*(t-2) + b;
554574
}
555575
});
556576

0 commit comments

Comments
 (0)