Skip to content

Commit 510ddbc

Browse files
Merge remote-tracking branch 'origin/v3'
Conflicts: bower.json package.json
2 parents a1edfc1 + b48c7e3 commit 510ddbc

File tree

14 files changed

+192
-116
lines changed

14 files changed

+192
-116
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "responsive",
33
"description": "A super lightweight HTML, Sass, CSS, and JavaScript framework for building responsive websites.",
4-
"version": "3.1.2",
4+
"version": "3.1.3",
55
"homepage": "http://responsivebp.com",
66
"authors": [
77
"James South"

build/responsive.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Copyright (c), James South.
66
Licensed under the MIT License.
77
============================================================================== */
8-
/*! Responsive v3.1.2 | MIT License | responsivebp.com */
8+
/*! Responsive v3.1.3 | MIT License | responsivebp.com */
99
/*! normalize.css v3.0.1 | MIT License | git.io/normalize */
1010
/**
1111
* 1. Set default font family to sans-serif.

build/responsive.js

Lines changed: 77 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Licensed under the MIT License.
77
============================================================================== */
88

9-
/*! Responsive v3.1.2 | MIT License | responsivebp.com */
9+
/*! Responsive v3.1.3 | MIT License | responsivebp.com */
1010

1111
/*
1212
* Responsive Core
@@ -757,7 +757,21 @@
757757
this.$indicators = this.options.indicators ? $(this.options.indicators) : this.$element.find("ol > li");
758758
this.id = this.$element.attr("id") || "carousel-" + $.pseudoUnique();
759759

760-
var self = this;
760+
var self = this,
761+
activeIndex = this.activeindex();
762+
763+
// Hide the previous button if no wrapping.
764+
if (!this.options.wrap) {
765+
if (activeIndex === 0) {
766+
this.$previousTrigger.hide().attr("aria-hidden", true);
767+
}
768+
}
769+
770+
// Hide both if one item.
771+
if (this.$items.length === 1) {
772+
this.$previousTrigger.hide().attr("aria-hidden", true);
773+
this.$nextTrigger.hide().attr("aria-hidden", true);
774+
}
761775

762776
// Add the css class to support fade.
763777
this.options.mode === "fade" && this.$element.addClass("carousel-fade");
@@ -962,8 +976,25 @@
962976
this.pause();
963977
}
964978

965-
// Highlight the correct indicator.
966979
this.$element.one(eslid, function () {
980+
981+
// Hide the correct trigger if necessary.
982+
if (!self.options.wrap) {
983+
var activePosition = self.activeindex();
984+
if (self.$items && activePosition === self.$items.length - 1) {
985+
self.$nextTrigger.hide().attr("aria-hidden", true);
986+
self.$previousTrigger.show().removeAttr("aria-hidden");
987+
}
988+
else if (self.$items && activePosition === 0) {
989+
self.$previousTrigger.hide().attr("aria-hidden", true);
990+
self.$nextTrigger.show().removeAttr("aria-hidden");
991+
} else {
992+
self.$nextTrigger.show().removeAttr("aria-hidden");
993+
self.$previousTrigger.show().removeAttr("aria-hidden");
994+
}
995+
}
996+
997+
// Highlight the correct indicator.
967998
self.$indicators.removeClass("active")
968999
.eq(self.activeindex()).addClass("active");
9691000
});
@@ -1097,7 +1128,6 @@
10971128

10981129
this.$items.not($activeItem).not($nextItem).removeClass("swipe swiping swipe-next").css({ "left": "", "right": "", "opacity": "" });
10991130

1100-
11011131
if ($nextItem.hasClass("carousel-active")) {
11021132
return;
11031133
}
@@ -2041,6 +2071,7 @@
20412071
hideEvent = $.Event(ehide),
20422072
hiddenEvent = $.Event(ehidden),
20432073
complete = function () {
2074+
self.destroy(callback);
20442075
$modal.removeData("currentModal");
20452076
self.$element.trigger(hiddenEvent);
20462077
};
@@ -2053,13 +2084,28 @@
20532084

20542085
this.isShown = false;
20552086

2056-
this.destroy(callback);
2087+
$.each([$header, $footer, $close, $modal, $next, $prev], function () {
2088+
this.removeClass("fade-in")
2089+
.redraw();
2090+
});
2091+
2092+
// Return focus events back to normal.
2093+
$(document).off(efocusin);
2094+
2095+
// Unbind the keyboard and touch actions.
2096+
if (this.options.keyboard) {
2097+
$(document).off(ekeydown);
2098+
}
2099+
2100+
if (this.options.touch) {
2101+
$modal.off("swipe.modal swipeend.modal");
2102+
}
20572103

20582104
if (!preserveOverlay) {
20592105
this.overlay(true);
20602106
}
20612107

2062-
$modal.onTransitionEnd(complete);
2108+
$modal.onTransitionEnd(complete).ensureTransitionEnd();
20632109
};
20642110

20652111
Modal.prototype.overlay = function (hide) {
@@ -2313,58 +2359,38 @@
23132359
};
23142360

23152361
Modal.prototype.destroy = function (callback) {
2316-
var self = this;
2317-
2318-
$.each([$header, $footer, $close, $modal, $next, $prev], function () {
2319-
this.removeClass("fade-in")
2320-
.redraw();
2321-
});
2322-
2323-
$modal.onTransitionEnd(function () {
23242362

2325-
// Clean up the next/prev.
2326-
$next.detach();
2327-
$prev.detach();
2363+
// Clean up the next/prev.
2364+
$next.detach();
2365+
$prev.detach();
23282366

2329-
// Clean up the header/footer.
2330-
$header.empty().detach();
2331-
$footer.empty().detach();
2332-
$close.detach();
2367+
// Clean up the header/footer.
2368+
$header.empty().detach();
2369+
$footer.empty().detach();
2370+
$close.detach();
23332371

2334-
// Remove label.
2335-
$overlay.removeAttr("aria-labelledby");
2372+
// Remove label.
2373+
$overlay.removeAttr("aria-labelledby");
23362374

2337-
if (!self.options.external) {
2338-
// Put that kid back where it came from or so help me.
2339-
$(self.options.target).addClass(self.isLocalHidden ? "hidden" : "").detach().insertAfter($placeholder);
2340-
$placeholder.detach().insertAfter($overlay);
2341-
}
2342-
2343-
// Fix __flash__removeCallback' is undefined error.
2344-
$.when($modal.find("iframe").attr("src", "")).then(w.setTimeout(function () {
2345-
2346-
$modal.removeClass("modal-iframe modal-ajax modal-image container").css({
2347-
"max-height": "",
2348-
"max-width": ""
2349-
}).empty();
2350-
2351-
// Return focus events back to normal.
2352-
$(document).off(efocusin);
2353-
2354-
// Unbind the keyboard and touch actions.
2355-
if (self.options.keyboard) {
2356-
$(document).off(ekeydown);
2357-
}
2375+
if (!this.options.external) {
2376+
// Put that kid back where it came from or so help me.
2377+
$(this.options.target).addClass(this.isLocalHidden ? "hidden" : "").detach().insertAfter($placeholder);
2378+
$placeholder.detach().insertAfter($overlay);
2379+
}
23582380

2359-
if (self.options.touch) {
2360-
$modal.off("swipe.modal swipeend.modal");
2361-
}
2381+
var self = this;
2382+
// Fix __flash__removeCallback' is undefined error.
2383+
$modal.find("iframe").attr("src", "");
2384+
w.setTimeout(function () {
23622385

2363-
// Handle callback passed from direction and linked calls.
2364-
callback && callback.call(self);
2365-
}, 100));
2386+
$modal.removeClass("modal-iframe modal-ajax modal-image container").css({
2387+
"max-height": "",
2388+
"max-width": ""
2389+
}).empty();
23662390

2367-
});
2391+
// Handle callback passed from direction and linked calls.
2392+
callback && callback.call(self);
2393+
}, 100);
23682394
};
23692395

23702396
Modal.prototype.click = function (event) {

build/responsive.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/responsive.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/responsive.zip

275 Bytes
Binary file not shown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "responsive",
33
"description": "A super lightweight HTML, Sass, CSS, and JavaScript framework for building responsive websites.",
4-
"version": "3.1.2",
4+
"version": "3.1.3",
55
"keywords": [
66
"responsive",
77
"css",

src/js/responsive.carousel.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,21 @@
6060
this.$indicators = this.options.indicators ? $(this.options.indicators) : this.$element.find("ol > li");
6161
this.id = this.$element.attr("id") || "carousel-" + $.pseudoUnique();
6262

63-
var self = this;
63+
var self = this,
64+
activeIndex = this.activeindex();
65+
66+
// Hide the previous button if no wrapping.
67+
if (!this.options.wrap) {
68+
if (activeIndex === 0) {
69+
this.$previousTrigger.hide().attr("aria-hidden", true);
70+
}
71+
}
72+
73+
// Hide both if one item.
74+
if (this.$items.length === 1) {
75+
this.$previousTrigger.hide().attr("aria-hidden", true);
76+
this.$nextTrigger.hide().attr("aria-hidden", true);
77+
}
6478

6579
// Add the css class to support fade.
6680
this.options.mode === "fade" && this.$element.addClass("carousel-fade");
@@ -265,8 +279,25 @@
265279
this.pause();
266280
}
267281

268-
// Highlight the correct indicator.
269282
this.$element.one(eslid, function () {
283+
284+
// Hide the correct trigger if necessary.
285+
if (!self.options.wrap) {
286+
var activePosition = self.activeindex();
287+
if (self.$items && activePosition === self.$items.length - 1) {
288+
self.$nextTrigger.hide().attr("aria-hidden", true);
289+
self.$previousTrigger.show().removeAttr("aria-hidden");
290+
}
291+
else if (self.$items && activePosition === 0) {
292+
self.$previousTrigger.hide().attr("aria-hidden", true);
293+
self.$nextTrigger.show().removeAttr("aria-hidden");
294+
} else {
295+
self.$nextTrigger.show().removeAttr("aria-hidden");
296+
self.$previousTrigger.show().removeAttr("aria-hidden");
297+
}
298+
}
299+
300+
// Highlight the correct indicator.
270301
self.$indicators.removeClass("active")
271302
.eq(self.activeindex()).addClass("active");
272303
});
@@ -400,7 +431,6 @@
400431

401432
this.$items.not($activeItem).not($nextItem).removeClass("swipe swiping swipe-next").css({ "left": "", "right": "", "opacity": "" });
402433

403-
404434
if ($nextItem.hasClass("carousel-active")) {
405435
return;
406436
}

src/js/responsive.core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
Licensed under the MIT License.
77
============================================================================== */
88

9-
/*! Responsive v3.1.2 | MIT License | responsivebp.com */
9+
/*! Responsive v3.1.3 | MIT License | responsivebp.com */
1010

1111
/*
1212
* Responsive Core

0 commit comments

Comments
 (0)