1
0
mirror of https://github.com/Hutchy68/pivot.git synced 2025-12-19 15:27:03 +01:00

Update to Foundation.js

This commit is contained in:
MW install maintain even with core development
2018-02-08 21:02:47 -05:00
parent cd535df66e
commit 8ae56081c1
21 changed files with 1239 additions and 799 deletions

View File

@@ -1,10 +1,12 @@
;(function ($, window, document, undefined) {
'use strict';
var openModals = [];
Foundation.libs.reveal = {
name : 'reveal',
version : '5.5.2',
version : '5.5.3',
locked : false,
@@ -155,7 +157,7 @@
settings = settings || this.settings;
if (modal.hasClass('open') && target.attr('data-reveal-id') == modal.attr('id')) {
if (modal.hasClass('open') && target !== undefined && target.attr('data-reveal-id') == modal.attr('id')) {
return self.close(modal);
}
@@ -188,16 +190,25 @@
};
}
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
if (open_modal.length > 0) {
if (settings.multiple_opened) {
var openModal = function() {
if(open_modal.length > 0) {
if(settings.multiple_opened) {
self.to_back(open_modal);
} else {
self.hide(open_modal, settings.css.close);
}
}
this.show(modal, settings.css.open);
// bl: add the open_modal that isn't already in the background to the openModals array
if(settings.multiple_opened) {
openModals.push(modal);
}
self.show(modal, settings.css.open);
};
if (typeof ajax_settings === 'undefined' || !ajax_settings.url) {
openModal();
} else {
var old_success = typeof ajax_settings.success !== 'undefined' ? ajax_settings.success : null;
$.extend(ajax_settings, {
@@ -218,14 +229,7 @@
self.S(modal).foundation('section', 'reflow');
self.S(modal).children().foundation();
if (open_modal.length > 0) {
if (settings.multiple_opened) {
self.to_back(open_modal);
} else {
self.hide(open_modal, settings.css.close);
}
}
self.show(modal, settings.css.open);
openModal();
}
});
@@ -263,8 +267,27 @@
}
if (settings.multiple_opened) {
var isCurrent = modal.is(':not(.toback)');
self.hide(modal, settings.css.close, settings);
self.to_front($($.makeArray(open_modals).reverse()[1]));
if(isCurrent) {
// remove the last modal since it is now closed
openModals.pop();
} else {
// if this isn't the current modal, then find it in the array and remove it
openModals = $.grep(openModals, function(elt) {
var isThis = elt[0]===modal[0];
if(isThis) {
// since it's not currently in the front, put it in the front now that it is hidden
// so that if it's re-opened, it won't be .toback
self.to_front(modal);
}
return !isThis;
});
}
// finally, show the next modal in the stack, if there is one
if(openModals.length>0) {
self.to_front(openModals[openModals.length - 1]);
}
} else {
self.hide(open_modals, settings.css.close, settings);
}
@@ -337,8 +360,9 @@
}, settings.animation_speed / 2);
}
css.top = $(window).scrollTop() + el.data('css-top') + 'px';
if (animData.fade) {
css.top = $(window).scrollTop() + el.data('css-top') + 'px';
var end_css = {opacity: 1};
return setTimeout(function () {