scrollreveal
Advanced tools
Comparing version 3.3.5 to 3.3.6
@@ -5,6 +5,8 @@ var ScrollReveal = (function () { | ||
var defaults = { | ||
origin: 'bottom', | ||
delay: 0, | ||
distance: '0', | ||
duration: 600, | ||
delay: 0, | ||
easing: 'cubic-bezier(0.6, 0.2, 0.1, 1)', | ||
opacity: 0, | ||
origin: 'bottom', | ||
rotate: { | ||
@@ -15,5 +17,3 @@ x: 0, | ||
}, | ||
opacity: 0, | ||
scale: 1, | ||
easing: 'cubic-bezier(0.6, 0.2, 0.1, 1)', | ||
container: document.documentElement, | ||
@@ -31,6 +31,6 @@ desktop: true, | ||
}, | ||
afterReset: function afterReset () {}, | ||
afterReveal: function afterReveal () {}, | ||
beforeReset: function beforeReset () {}, | ||
beforeReveal: function beforeReveal () {}, | ||
beforeReset: function beforeReset () {}, | ||
afterReveal: function afterReveal () {}, | ||
afterReset: function afterReset () {}, | ||
}; | ||
@@ -168,3 +168,3 @@ | ||
var container = this.store.containers[element.containerId]; | ||
var viewFactor = element.config.viewFactor; | ||
var viewFactor = Math.max(0, Math.min(1, element.config.viewFactor)); | ||
var viewOffset = element.config.viewOffset; | ||
@@ -181,4 +181,4 @@ | ||
top: container.geometry.bounds.top + container.scroll.top + viewOffset.top, | ||
right: container.geometry.bounds.right + container.scroll.left + viewOffset.right, | ||
bottom: container.geometry.bounds.bottom + container.scroll.top + viewOffset.bottom, | ||
right: container.geometry.bounds.right + container.scroll.left - viewOffset.right, | ||
bottom: container.geometry.bounds.bottom + container.scroll.top - viewOffset.bottom, | ||
left: container.geometry.bounds.left + container.scroll.left + viewOffset.left, | ||
@@ -237,6 +237,8 @@ }; | ||
node = container.querySelector(target); | ||
if (!node) { logger(("Querying the selector \"" + target + "\" returned nothing.")); } | ||
} catch (err) { | ||
logger(("\"" + target + "\" is not a valid selector.")); | ||
} catch (e) { | ||
throw new Error(("\"" + target + "\" is not a valid selector.")) | ||
} | ||
if (!node) { | ||
throw new Error(("The selector \"" + target + "\" matches 0 elements.")) | ||
} | ||
} | ||
@@ -250,15 +252,20 @@ return isNode(target) ? target : node | ||
if (isNode(target)) { return [target] } | ||
if (isNodeList(target)) { return Array.prototype.slice.call(target) } | ||
if (isNode(target)) { | ||
return [target] | ||
} | ||
if (isNodeList(target)) { | ||
return Array.prototype.slice.call(target) | ||
} | ||
var query; | ||
if (typeof target === 'string') { | ||
try { | ||
var query = container.querySelectorAll(target); | ||
var nodes = Array.prototype.slice.call(query); | ||
if (nodes.length) { return nodes } | ||
logger(("Querying the selector \"" + target + "\" returned nothing.")); | ||
} catch (error) { | ||
logger(("\"" + target + "\" is not a valid selector.")); | ||
query = container.querySelectorAll(target); | ||
} catch (e) { | ||
throw new Error(("\"" + target + "\" is not a valid selector.")) | ||
} | ||
if (query.length === 0) { | ||
throw new Error(("The selector \"" + target + "\" matches 0 elements.")) | ||
} | ||
} | ||
return [] | ||
return Array.prototype.slice.call(query) | ||
} | ||
@@ -283,3 +290,3 @@ | ||
if (console) { | ||
if (this.debug && console) { | ||
var report = "ScrollReveal: " + message; | ||
@@ -313,7 +320,10 @@ details.forEach(function (detail) { return report += "\n - " + detail; }); | ||
*/ | ||
each(getNodes('[data-sr-id]'), function (node) { | ||
var id = parseInt(node.getAttribute('data-sr-id')); | ||
elementIds.active.push(id); | ||
}); | ||
try { | ||
each(getNodes('[data-sr-id]'), function (node) { | ||
var id = parseInt(node.getAttribute('data-sr-id')); | ||
elementIds.active.push(id); | ||
}); | ||
} catch (e) { | ||
throw e | ||
} | ||
/** | ||
@@ -376,14 +386,23 @@ * Destroy stale elements. | ||
var dirty; | ||
try { | ||
each(getNodes(target), function (node) { | ||
var id = node.getAttribute('data-sr-id'); | ||
if (id !== null) { | ||
dirty = true; | ||
node.setAttribute('style', this$1.store.elements[id].styles.inline); | ||
node.removeAttribute('data-sr-id'); | ||
delete this$1.store.elements[id]; | ||
} | ||
}); | ||
} catch (e) { | ||
return logger.call(this, 'Clean failed.', e.message) | ||
} | ||
each(getNodes(target), function (node) { | ||
var id = node.getAttribute('data-sr-id'); | ||
if (id !== null) { | ||
dirty = true; | ||
node.setAttribute('style', this$1.store.elements[id].styles.inline); | ||
node.removeAttribute('data-sr-id'); | ||
delete this$1.store.elements[id]; | ||
if (dirty) { | ||
try { | ||
rinse.call(this); | ||
} catch (e) { | ||
return logger.call(this, 'Clean failed.', 'Rinse failed.', e.message) | ||
} | ||
}); | ||
if (dirty) { rinse.call(this); } | ||
} | ||
} | ||
@@ -427,3 +446,3 @@ | ||
/* @license Redpill v0.4.1 | ||
/* @license Rematrix v0.1.0 | ||
@@ -451,3 +470,3 @@ Copyright (c) 2017, Fisssion LLC | ||
/** | ||
* @module Redpill | ||
* @module Rematrix | ||
*/ | ||
@@ -506,24 +525,19 @@ | ||
/** | ||
* Returns a 4x4 matrix describing the combined transformations | ||
* of both arguments. | ||
* Returns a matrix describing the inverse transformation of the source | ||
* matrix. When a transformation is combined with its inverse, the product | ||
* is the identity matrix (ie. no transformation). | ||
* | ||
* > **Note:** Order is very important. For example, rotating 90° | ||
* along the Z-axis, followed by translating 500 pixels along the | ||
* Y-axis... is not the same as translating 500 pixels along the | ||
* Y-axis, followed by rotating 45° along on the Z-axis. | ||
* | ||
* @param {array} m1 - Accepts both short and long form matrices. | ||
* @param {array} m2 - Accepts both short and long form matrices. | ||
* @param {array} source - Accepts both short and long form matrices. | ||
* @return {array} | ||
*/ | ||
function multiply (m1, m2) { | ||
var fm1 = format(m1); | ||
var fm2 = format(m2); | ||
function multiply (m, x) { | ||
var fm = format(m); | ||
var fx = format(x); | ||
var product = []; | ||
for (var i = 0; i < 4; i++) { | ||
var row = [fm1[i], fm1[i + 4], fm1[i + 8], fm1[i + 12]]; | ||
var row = [fm[i], fm[i + 4], fm[i + 8], fm[i + 12]]; | ||
for (var j = 0; j < 4; j++) { | ||
var k = j * 4; | ||
var col = [fm2[k], fm2[k + 1], fm2[k + 2], fm2[k + 3]]; | ||
var col = [fx[k], fx[k + 1], fx[k + 2], fx[k + 3]]; | ||
var result = row[0] * col[0] + row[1] * col[1] + row[2] * col[2] + row[3] * col[3]; | ||
@@ -540,7 +554,9 @@ | ||
/** | ||
* Attempts to returns a 4x4 matrix describing the CSS transform matrix passed | ||
* in, but will return the identity matrix as a fallback. | ||
* Attempts to return a 4x4 matrix describing the CSS transform | ||
* matrix passed in, but will return the identity matrix as a | ||
* fallback. | ||
* | ||
* **Tip:** In virtually all cases, this method is used to convert a CSS matrix | ||
* (retrieved as a `string` from computed styles) to its equivalent array format. | ||
* **Tip:** In virtually all cases, this method is used to convert | ||
* a CSS matrix (retrieved as a `string` from computed styles) to | ||
* its equivalent array format. | ||
* | ||
@@ -634,7 +650,7 @@ * @param {string} source - String containing a valid CSS `matrix` or `matrix3d` property. | ||
/** | ||
* Returns a 4x4 matrix describing X-axis translation. | ||
* | ||
* @param {number} distance - Measured in pixels. | ||
* @return {array} | ||
*/ | ||
* Returns a 4x4 matrix describing X-axis scaling. | ||
* | ||
* @param {number} scalar - Decimal multiplier. | ||
* @return {array} | ||
*/ | ||
function translateX (distance) { | ||
@@ -659,2 +675,10 @@ var matrix = identity(); | ||
/** | ||
* Returns a 4x4 matrix describing Z-axis translation. | ||
* | ||
* @param {number} distance - Measured in pixels. | ||
* @return {array} | ||
*/ | ||
function style (element) { | ||
@@ -738,3 +762,7 @@ var computed = window.getComputedStyle(element.node); | ||
if (config.rotate.z) { transformations.push(rotateZ(config.rotate.z)); } | ||
if (config.scale !== 1) { transformations.push(scale(config.scale)); } | ||
if (config.scale !== 1) { | ||
config.scale === 0 | ||
? transformations.push(scale(0.0002)) | ||
: transformations.push(scale(config.scale)); | ||
} | ||
@@ -820,2 +848,7 @@ var transform = {}; | ||
}; | ||
} else { | ||
transition.generated = { | ||
delayed: '', | ||
instant: '', | ||
}; | ||
} | ||
@@ -849,3 +882,3 @@ | ||
element.node.setAttribute('style', styles.join(' ')); | ||
element.node.setAttribute('style', styles.filter(function (i) { return i !== ''; }).join(' ')); | ||
}); | ||
@@ -892,8 +925,16 @@ | ||
var containers = this.store.containers; | ||
var container = getNode(config.container); | ||
var targets = getNodes(target, container); | ||
if (!targets.length) { | ||
logger('Reveal aborted.', 'Reveal cannot be performed on 0 elements.'); | ||
return | ||
var container; | ||
var targets; | ||
try { | ||
container = getNode(config.container); | ||
if (!container) { | ||
throw new Error('Invalid container.') | ||
} | ||
targets = getNodes(target, container); | ||
if (!targets) { | ||
throw new Error('Nothing to animate.') | ||
} | ||
} catch (e) { | ||
return logger.call(this, 'Reveal failed.', e.message) | ||
} | ||
@@ -905,4 +946,3 @@ | ||
if (!config.mobile && isMobile() || !config.desktop && !isMobile()) { | ||
logger('Reveal aborted.', 'This platform has been disabled.'); | ||
return | ||
return logger.call(this, 'Reveal aborted.', 'This platform has been disabled.') | ||
} | ||
@@ -919,4 +959,4 @@ | ||
elementIds: [], | ||
head: { index: null, blocked: false }, | ||
tail: { index: null, blocked: false }, | ||
nose: { blocked: false, index: null, pointer: null }, | ||
tail: { blocked: false, index: null, pointer: null }, | ||
id: sequenceId, | ||
@@ -926,4 +966,3 @@ interval: Math.abs(interval), | ||
} else { | ||
logger('Reveal failed.', 'Sequence intervals must be at least 16 milliseconds.'); | ||
return | ||
return logger.call(this, 'Reveal failed.', 'Sequence interval must be at least 16ms.') | ||
} | ||
@@ -962,2 +1001,3 @@ } | ||
element.seen = false; | ||
element.revealed = false; | ||
element.visible = false; | ||
@@ -991,5 +1031,4 @@ } | ||
} catch (error) { | ||
logger('Reveal failed.', error.message); | ||
return | ||
} catch (e) { | ||
return logger.call(this, 'Reveal failed.', e.message) | ||
} | ||
@@ -1024,6 +1063,2 @@ | ||
/** | ||
* Re-runs the reveal method for each record stored in history, | ||
* for capturing new content asynchronously loaded into the DOM. | ||
*/ | ||
function sync () { | ||
@@ -1039,70 +1074,80 @@ var this$1 = this; | ||
function animate (element) { | ||
var this$1 = this; | ||
function animate (element, sequencing) { | ||
var isDelayed = element.config.useDelay === 'always' | ||
var sequence = (element.sequence) ? this.store.sequences[element.sequence.id] : false; | ||
var delayed = element.config.useDelay === 'always' | ||
|| element.config.useDelay === 'onload' && this.pristine | ||
|| element.config.useDelay === 'once' && !element.seen; | ||
var sequence = (element.sequence) ? this.store.sequences[element.sequence.id] : null; | ||
var styles = [element.styles.inline]; | ||
element.visible = isElementVisible.call(this, element); | ||
if (isElementVisible.call(this, element) && !element.visible) { | ||
if (sequencing) { | ||
if (element.sequence.index === sequence.nose.pointer - 1 && sequence.nose.pointer > sequence.nose.index) { | ||
sequence.nose.pointer--; | ||
queueSequenceNose.call(this, sequence); | ||
} else if (element.sequence.index === sequence.tail.pointer + 1 && sequence.tail.pointer < sequence.tail.index) { | ||
sequence.tail.pointer++; | ||
queueSequenceTail.call(this, sequence); | ||
} else { | ||
return | ||
} | ||
return triggerReveal.call(this, element, delayed) | ||
} | ||
if (sequence !== null) { | ||
if (sequence.head.index === null && sequence.tail.index === null) { | ||
sequence.head.index = sequence.tail.index = element.sequence.index; | ||
sequence.head.blocked = sequence.tail.blocked = true; | ||
} else if (sequence.head.index - 1 === element.sequence.index && !sequence.head.blocked) { | ||
sequence.head.index--; | ||
sequence.head.blocked = true; | ||
} else if (sequence.tail.index + 1 === element.sequence.index && !sequence.tail.blocked) { | ||
sequence.tail.index++; | ||
sequence.tail.blocked = true; | ||
} else { return } | ||
window.setTimeout(function () { | ||
sequence.head.blocked = sequence.tail.blocked = false; | ||
this$1.delegate(); | ||
}, sequence.interval); | ||
if (element.visible && !element.revealed) { | ||
if (sequence) { | ||
updateSequenceIndexes.call(this, sequence); | ||
if (sequence.nose.pointer === null && sequence.tail.pointer === null) { | ||
sequence.nose.pointer = sequence.tail.pointer = element.sequence.index; | ||
queueSequenceNose.call(this, sequence); | ||
queueSequenceTail.call(this, sequence); | ||
} else if (element.sequence.index === sequence.nose.pointer - 1 && !sequence.nose.blocked) { | ||
sequence.nose.pointer--; | ||
queueSequenceNose.call(this, sequence); | ||
} else if (element.sequence.index === sequence.tail.pointer + 1 && !sequence.tail.blocked) { | ||
sequence.tail.pointer++; | ||
queueSequenceTail.call(this, sequence); | ||
} else { | ||
return | ||
} | ||
} | ||
return triggerReveal.call(this, element, delayed) | ||
} | ||
styles.push(element.styles.opacity.computed); | ||
styles.push(element.styles.transform.generated.final); | ||
if (isDelayed) { | ||
styles.push(element.styles.transition.generated.delayed); | ||
} else { | ||
styles.push(element.styles.transition.generated.instant); | ||
if (!element.visible && element.revealed && element.config.reset) { | ||
if (sequence) { | ||
updateSequenceIndexes.call(this, sequence); | ||
if (sequence.nose.index !== Infinity && sequence.tail.index !== -Infinity) { | ||
sequence.nose.pointer = Math.max(sequence.nose.pointer, sequence.nose.index); | ||
sequence.tail.pointer = Math.min(sequence.tail.pointer, sequence.tail.index); | ||
} | ||
} | ||
return triggerReset.call(this, element) | ||
} | ||
} | ||
element.seen = true; | ||
element.visible = true; | ||
registerCallbacks.call(this, element, isDelayed); | ||
element.node.setAttribute('style', styles.join(' ')); | ||
} else { | ||
if (!isElementVisible.call(this, element) && element.visible && element.config.reset) { | ||
function triggerReveal (element, delayed) { | ||
var styles = [ | ||
element.styles.inline, | ||
element.styles.opacity.computed, | ||
element.styles.transform.generated.final ]; | ||
delayed | ||
? styles.push(element.styles.transition.generated.delayed) | ||
: styles.push(element.styles.transition.generated.instant); | ||
element.revealed = element.seen = true; | ||
element.node.setAttribute('style', styles.filter(function (i) { return i !== ''; }).join(' ')); | ||
registerCallbacks.call(this, element, delayed); | ||
} | ||
if (sequence) { | ||
if (sequence.head.index === element.sequence.index) { | ||
sequence.head.index++; | ||
} else if (sequence.tail.index === element.sequence.index) { | ||
sequence.tail.index--; | ||
} else { return } | ||
} | ||
styles.push(element.styles.opacity.generated); | ||
styles.push(element.styles.transform.generated.initial); | ||
styles.push(element.styles.transition.generated.instant); | ||
element.visible = false; | ||
registerCallbacks.call(this, element); | ||
element.node.setAttribute('style', styles.join(' ')); | ||
} | ||
} | ||
function triggerReset (element) { | ||
var styles = [ | ||
element.styles.inline, | ||
element.styles.opacity.generated, | ||
element.styles.transform.generated.initial, | ||
element.styles.transition.generated.instant ]; | ||
element.revealed = false; | ||
element.node.setAttribute('style', styles.filter(function (i) { return i !== ''; }).join(' ')); | ||
registerCallbacks.call(this, element); | ||
} | ||
@@ -1114,16 +1159,14 @@ | ||
var duration = (isDelayed) | ||
var duration = isDelayed | ||
? element.config.duration + element.config.delay | ||
: element.config.duration; | ||
var afterCallback; | ||
if (element.visible) { | ||
element.config.beforeReveal(element.node); | ||
afterCallback = element.config.afterReveal; | ||
} else { | ||
element.config.beforeReset(element.node); | ||
afterCallback = element.config.afterReset; | ||
} | ||
var beforeCallback = element.revealed | ||
? element.config.beforeReveal | ||
: element.config.beforeReset; | ||
var afterCallback = element.revealed | ||
? element.config.afterReveal | ||
: element.config.afterReset; | ||
var elapsed = 0; | ||
@@ -1135,2 +1178,4 @@ if (element.callbackTimer) { | ||
beforeCallback(element.node); | ||
element.callbackTimer = { | ||
@@ -1141,3 +1186,3 @@ start: Date.now(), | ||
element.callbackTimer = null; | ||
if (element.visible && !element.config.reset) { | ||
if (element.revealed && !element.config.reset) { | ||
clean.call(this$1, element.node); | ||
@@ -1149,2 +1194,49 @@ } | ||
function updateSequenceIndexes (sequence) { | ||
var this$1 = this; | ||
var min = Infinity; | ||
var max = -Infinity; | ||
each(sequence.elementIds, function (id) { | ||
var element = this$1.store.elements[id]; | ||
if (element && element.visible) { | ||
min = Math.min(min, element.sequence.index); | ||
max = Math.max(max, element.sequence.index); | ||
} | ||
}); | ||
sequence.nose.index = min; | ||
sequence.tail.index = max; | ||
} | ||
function queueSequenceNose (sequence) { | ||
var this$1 = this; | ||
var nextId = sequence.elementIds[sequence.nose.pointer - 1]; | ||
var nextElement = this.store.elements[nextId]; | ||
if (nextElement) { | ||
sequence.nose.blocked = true; | ||
window.setTimeout(function () { | ||
sequence.nose.blocked = false; | ||
animate.call(this$1, nextElement, true); | ||
}, sequence.interval); | ||
} | ||
} | ||
function queueSequenceTail (sequence) { | ||
var this$1 = this; | ||
var nextId = sequence.elementIds[sequence.tail.pointer + 1]; | ||
var nextElement = this.store.elements[nextId]; | ||
if (nextElement) { | ||
sequence.tail.blocked = true; | ||
window.setTimeout(function () { | ||
sequence.tail.blocked = false; | ||
animate.call(this$1, nextElement, true); | ||
}, sequence.interval); | ||
} | ||
} | ||
var polyfill = (function () { | ||
@@ -1201,5 +1293,6 @@ var clock = Date.now(); | ||
var version = "4.0.0-beta.2"; | ||
var version = "4.0.0-beta.9"; | ||
function ScrollReveal (options) { | ||
var this$1 = this; | ||
if ( options === void 0 ) options = {}; | ||
@@ -1215,4 +1308,12 @@ | ||
var _debug = false; | ||
Object.defineProperty(this, 'debug', { | ||
get: function () { return _debug; }, | ||
set: function (value) { | ||
if (typeof value === 'boolean') { _debug = value; } | ||
}, | ||
}); | ||
if (!ScrollReveal.isSupported()) { | ||
logger('Instantiation aborted.', 'This browser is not supported.'); | ||
logger.call(this, 'Instantiation aborted.', 'This browser is not supported.'); | ||
return noop | ||
@@ -1224,15 +1325,18 @@ } | ||
get: (function () { | ||
var config = {}; | ||
deepAssign(config, defaults, options); | ||
var config = deepAssign({}, defaults, options); | ||
return function () { return config; } | ||
})(), | ||
}); | ||
} catch (error) { | ||
logger('Instantiation failed.', 'Invalid configuration provided.', error.message); | ||
} catch (e) { | ||
logger.call(this, 'Instantiation failed.', 'Invalid configuration.', e.message); | ||
return noop | ||
} | ||
var container = getNode(this.defaults.container); | ||
if (!container) { | ||
logger('Instantiation failed.', 'Invalid or missing container.'); | ||
try { | ||
var container = getNode(this.defaults.container); | ||
if (!container) { | ||
throw new Error('Invalid container.') | ||
} | ||
} catch (e) { | ||
logger.call(this, 'Instantiation failed.', e.message); | ||
return noop | ||
@@ -1253,11 +1357,6 @@ } | ||
this.pristine = true; | ||
this.delegate = delegate.bind(this); | ||
Object.defineProperty(this, 'version', { | ||
get: function () { return version; }, | ||
}); | ||
Object.defineProperty(this, 'noop', { | ||
get: function () { return false; }, | ||
}); | ||
Object.defineProperty(this, 'delegate', { get: function () { return delegate.bind(this$1); } }); | ||
Object.defineProperty(this, 'version', { get: function () { return version; } }); | ||
Object.defineProperty(this, 'noop', { get: function () { return false; } }); | ||
} | ||
@@ -1290,3 +1389,3 @@ | ||
* ------------ | ||
* Website : https://scrollreveal.com | ||
* Website : https://scrollrevealjs.org | ||
* Support : https://github.com/jlmakes/scrollreveal/issues | ||
@@ -1300,3 +1399,3 @@ * Author : https://twitter.com/jlmakes | ||
* keep your source code proprietary and please purchase a | ||
* commercial license from https://scrollreveal.com | ||
* commercial license from https://scrollrevealjs.org | ||
* | ||
@@ -1303,0 +1402,0 @@ * Copyright (c) 2014–2017 Julian Lloyd. All rights reserved. |
# Changelog | ||
### 3.3.5 - _2017, February 18th | ||
### 3.3.6 - _2017, June 23rd | ||
Includes patchwork up to 3.3.5. | ||
Includes patchwork up to 3.3.6. | ||
#### Features | ||
- **[#273](https://github.com/jlmakes/scrollreveal.js/issues/273) New Callbacks:** `beforeReveal(el)` | ||
- **[#273](https://github.com/jlmakes/scrollreveal.js/issues/273) New Callback:** `beforeReset(el)` | ||
- **[#273](https://github.com/jlmakes/scrollreveal/issues/273) New Callbacks:** `beforeReveal(el)` | ||
- **[#273](https://github.com/jlmakes/scrollreveal/issues/273) New Callback:** `beforeReset(el)` | ||
@@ -27,4 +27,5 @@ _Example:_ | ||
- *Functionality*: The default `config.container` now recognizes selectors (Fixes [#289](https://github.com/jlmakes/scrollreveal.js/issues/289)) | ||
- *Compatibility*: Added missing trailing semi-colon (Fixes [#278](https://github.com/jlmakes/scrollreveal.js/issues/278)) | ||
- *Functionality*: Element visibility detection has been improved. (Fixes [#352](https://github.com/jlmakes/scrollreveal/issues/352)) | ||
- *Functionality*: The default `config.container` now recognizes selectors (Fixes [#289](https://github.com/jlmakes/scrollreveal/issues/289)) | ||
- *Compatibility*: Added missing trailing semi-colon (Fixes [#278](https://github.com/jlmakes/scrollreveal/issues/278)) | ||
@@ -50,11 +51,11 @@ ### 3.2.0 — _2016, July 8th_ | ||
- *Compatibility*: Replace automatic module wrapper with a manual solution (Fixes [#253](https://github.com/jlmakes/scrollreveal.js/issues/253)) | ||
- *Functionality*: Fix `config.distance` values when `config.origin` is `top` or `left`.(Fixes [#270](https://github.com/jlmakes/scrollreveal.js/issues/270)) | ||
- *Functionality*: Correctly record the interval argument for `sync()` (Fixes [#268](https://github.com/jlmakes/scrollreveal.js/issues/268)) | ||
- *Functionality*: Fix animation sequence with `config.reset` (Fixes [#241](https://github.com/jlmakes/scrollreveal.js/issues/241)) | ||
- *Compatibility*: Replace automatic module wrapper with a manual solution (Fixes [#253](https://github.com/jlmakes/scrollreveal/issues/253)) | ||
- *Functionality*: Fix `config.distance` values when `config.origin` is `top` or `left`.(Fixes [#270](https://github.com/jlmakes/scrollreveal/issues/270)) | ||
- *Functionality*: Correctly record the interval argument for `sync()` (Fixes [#268](https://github.com/jlmakes/scrollreveal/issues/268)) | ||
- *Functionality*: Fix animation sequence with `config.reset` (Fixes [#241](https://github.com/jlmakes/scrollreveal/issues/241)) | ||
#### Improvements | ||
- *Compatibility*: Add `requestAnimationFrame` fallback. (Resolves [#267](https://github.com/jlmakes/scrollreveal.js/issues/267)) | ||
- *Functionality*: Remove `console.log()` from minified distribution (Fixes [#235](https://github.com/jlmakes/scrollreveal.js/issues/235)) | ||
- *Compatibility*: Add `requestAnimationFrame` fallback. (Resolves [#267](https://github.com/jlmakes/scrollreveal/issues/267)) | ||
- *Functionality*: Remove `console.log()` from minified distribution (Fixes [#235](https://github.com/jlmakes/scrollreveal/issues/235)) | ||
@@ -103,13 +104,13 @@ ### 3.1.0 — _2016, February 22nd_ | ||
- *Functionality*: Add missing support for `config.mobile` (Fixes [#216](https://github.com/jlmakes/scrollreveal.js/issues/216)) | ||
- *Functionality*: Return correct value when checking element visibility. (Fixes [#193](https://github.com/jlmakes/scrollreveal.js/issues/193), [#196](https://github.com/jlmakes/scrollreveal.js/issues/196)) | ||
- *Functionality*: Improve runtime for chained `reveal()` calls. (Fixes [#212](https://github.com/jlmakes/scrollreveal.js/issues/212)) | ||
- *Compatibility*: Debug Internet Explorer 9. (Fixes [#230](https://github.com/jlmakes/scrollreveal.js/pull/230)) | ||
- *Compatibility*: Debug Chrome on iOS. (Fixes [#196](https://github.com/jlmakes/scrollreveal.js/issues/196)) | ||
- *Functionality*: Add missing support for `config.mobile` (Fixes [#216](https://github.com/jlmakes/scrollreveal/issues/216)) | ||
- *Functionality*: Return correct value when checking element visibility. (Fixes [#193](https://github.com/jlmakes/scrollreveal/issues/193), [#196](https://github.com/jlmakes/scrollreveal/issues/196)) | ||
- *Functionality*: Improve runtime for chained `reveal()` calls. (Fixes [#212](https://github.com/jlmakes/scrollreveal/issues/212)) | ||
- *Compatibility*: Debug Internet Explorer 9. (Fixes [#230](https://github.com/jlmakes/scrollreveal/pull/230)) | ||
- *Compatibility*: Debug Chrome on iOS. (Fixes [#196](https://github.com/jlmakes/scrollreveal/issues/196)) | ||
- *Compatibility*: Explicitly reference `window` object. | ||
- *Compatibility*: Adjust AMD configuration for Webpack (Fixes [#209](https://github.com/jlmakes/scrollreveal.js/issues/209)) | ||
- *Compatibility*: Adjust AMD configuration for Webpack (Fixes [#209](https://github.com/jlmakes/scrollreveal/issues/209)) | ||
#### Improvements | ||
- *Functionality*: Overwrite (instead of destroy) existing transition styles. (Resolves [#197](https://github.com/jlmakes/scrollreveal.js/issues/197)) | ||
- *Functionality*: Overwrite (instead of destroy) existing transition styles. (Resolves [#197](https://github.com/jlmakes/scrollreveal/issues/197)) | ||
- *Functionality*: Fail silently with `console.log` instead of `console.warn` | ||
@@ -172,7 +173,7 @@ - *Performance*: Refactored initialization when using `sync()` | ||
- **JavaScript API**: All new developer interface. (Resolves [#1](https://github.com/jlmakes/scrollreveal.js/issues/1), [#122](https://github.com/jlmakes/scrollreveal.js/issues/122)) | ||
- **JavaScript API**: All new developer interface. (Resolves [#1](https://github.com/jlmakes/scrollreveal/issues/1), [#122](https://github.com/jlmakes/scrollreveal/issues/122)) | ||
- Easily configure (and re-configure) multiple reveal sets | ||
- Makes working with aysnchronous content a breeze | ||
- Drastically cleaner markup | ||
- **Horizontal Scrolling**: Add support for horizontal scrolling. (Resolves [#184](https://github.com/jlmakes/scrollreveal.js/issues/184)) | ||
- **Horizontal Scrolling**: Add support for horizontal scrolling. (Resolves [#184](https://github.com/jlmakes/scrollreveal/issues/184)) | ||
- **New Callback**: `config.afterReset` — triggers when an element completely resets. | ||
@@ -183,3 +184,3 @@ | ||
- *Performance*: 44% smaller, only 2.8KB minified and g-zipped. | ||
- *Functionality*: Reveals now resolve to the element’s computed opacity, instead of `1`. (Resolves [#185](https://github.com/jlmakes/scrollreveal.js/issues/185)) | ||
- *Functionality*: Reveals now resolve to the element’s computed opacity, instead of `1`. (Resolves [#185](https://github.com/jlmakes/scrollreveal/issues/185)) | ||
- *Functionality*: The reliability of callback timers has been greatly improved. | ||
@@ -191,3 +192,3 @@ | ||
The latest stable build of version 2. See [Legacy Documentation (v2.x)](https://github.com/jlmakes/scrollreveal.js/wiki) | ||
The latest stable build of version 2. See [Legacy Documentation (v2.x)](https://github.com/jlmakes/scrollreveal/wiki) | ||
@@ -198,3 +199,3 @@ >**Note:** There were some issues publishing this version on Bower, and so `v2.3.2` was patched to `v2.3.3` to get it back on Bower. There is no meaningful difference between the two. | ||
- Support instantiation without `new` keyword. (Pull request [#148](https://github.com/jlmakes/scrollreveal.js/pull/230)) | ||
- Support instantiation without `new` keyword. (Pull request [#148](https://github.com/jlmakes/scrollreveal/pull/230)) | ||
@@ -213,5 +214,5 @@ ```js | ||
- **New Keyword** `opacity` — control animation starting opacity. (Resolves [#95](https://github.com/jlmakes/scrollreveal.js/issues/95)) | ||
- **New Keyword** `opacity` — control animation starting opacity. (Resolves [#95](https://github.com/jlmakes/scrollreveal/issues/95)) | ||
- e.g. `data-sr="opacity 0.5"` | ||
- **New Keywords** `vFactor`, `vF` — control element view factor. (Resolves [#94](https://github.com/jlmakes/scrollreveal.js/issues/94), [#142](https://github.com/jlmakes/scrollreveal.js/issues/142)) | ||
- **New Keywords** `vFactor`, `vF` — control element view factor. (Resolves [#94](https://github.com/jlmakes/scrollreveal/issues/94), [#142](https://github.com/jlmakes/scrollreveal/issues/142)) | ||
- e.g. `data-sr="vF 0.3"`) | ||
@@ -228,5 +229,5 @@ | ||
- **New Keywords** `spin`, `roll`, `flip` — control rotation during animation. ([#138](https://github.com/jlmakes/scrollreveal.js/pull/138)) | ||
- **New Keywords** `spin`, `roll`, `flip` — control rotation during animation. ([#138](https://github.com/jlmakes/scrollreveal/pull/138)) | ||
- e.g. `data-sr="roll 20deg"` | ||
- Special thanks to **[@satrun77](https://github.com/satrun77)** ([#119](https://github.com/jlmakes/scrollreveal.js/pull/119)) | ||
- Special thanks to **[@satrun77](https://github.com/satrun77)** ([#119](https://github.com/jlmakes/scrollreveal/pull/119)) | ||
@@ -241,5 +242,5 @@ *** | ||
- *Functionality*: Add missing custom viewport event bindings | ||
- *Functionality*: Add tablets to mobile device user agent regex (Fixes [#81](https://github.com/jlmakes/scrollreveal.js/issues/81)) | ||
- *Functionality*: Better handle previously initialized nodes (Fixes [#98](https://github.com/jlmakes/scrollreveal.js/issues/98)) | ||
- *Functionality*: Refactor animator. (Fixes [#96](https://github.com/jlmakes/scrollreveal.js/issues/96)) | ||
- *Functionality*: Add tablets to mobile device user agent regex (Fixes [#81](https://github.com/jlmakes/scrollreveal/issues/81)) | ||
- *Functionality*: Better handle previously initialized nodes (Fixes [#98](https://github.com/jlmakes/scrollreveal/issues/98)) | ||
- *Functionality*: Refactor animator. (Fixes [#96](https://github.com/jlmakes/scrollreveal/issues/96)) | ||
- Bug source: [setTimeout in for-loop does not print consecutive values](http://stackoverflow.com/questions/5226285/settimeout-in-for-loop-does-not-print-consecutive-values) | ||
@@ -250,4 +251,4 @@ - *Compatibility*: Update Bower and NPM `/dist` paths | ||
- *Performance*: Remove `data-sr` attributes from the DOM that have already registered (Resolves [#100](https://github.com/jlmakes/scrollreveal.js/issues/100)) | ||
- *Functionality*: Requires CSS Transition support. (Resolves [#109](https://github.com/jlmakes/scrollreveal.js/issues/109)) | ||
- *Performance*: Remove `data-sr` attributes from the DOM that have already registered (Resolves [#100](https://github.com/jlmakes/scrollreveal/issues/100)) | ||
- *Functionality*: Requires CSS Transition support. (Resolves [#109](https://github.com/jlmakes/scrollreveal/issues/109)) | ||
@@ -254,0 +255,0 @@ *** |
@@ -19,3 +19,3 @@ ///// ///// ///// ///// | ||
* ------------ | ||
* Version : 3.3.4 | ||
* Version : 3.3.6 | ||
* Website : scrollrevealjs.org | ||
@@ -39,3 +39,3 @@ * Repo : github.com/jlmakes/scrollreveal.js | ||
sr = this // Save reference to instance. | ||
sr.version = '3.3.4' | ||
sr.version = '3.3.6' | ||
sr.tools = new Tools() // *required utilities | ||
@@ -763,4 +763,4 @@ | ||
bottom > viewTop && | ||
left > viewLeft && | ||
right < viewRight | ||
left < viewRight && | ||
right > viewLeft | ||
} | ||
@@ -767,0 +767,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";function e(n){return"undefined"==typeof this||Object.getPrototypeOf(this)!==e.prototype?new e(n):(O=this,O.version="3.3.4",O.tools=new E,O.isSupported()?(O.tools.extend(O.defaults,n||{}),O.defaults.container=t(O.defaults),O.store={elements:{},containers:[]},O.sequences={},O.history=[],O.uid=0,O.initialized=!1):"undefined"!=typeof console&&null!==console,O)}function t(e){if(e&&e.container){if("string"==typeof e.container)return window.document.documentElement.querySelector(e.container);if(O.tools.isNode(e.container))return e.container}return O.defaults.container}function n(e,t){return"string"==typeof e?Array.prototype.slice.call(t.querySelectorAll(e)):O.tools.isNode(e)?[e]:O.tools.isNodeList(e)?Array.prototype.slice.call(e):[]}function i(){return++O.uid}function o(e,t,n){t.container&&(t.container=n),e.config?e.config=O.tools.extendClone(e.config,t):e.config=O.tools.extendClone(O.defaults,t),"top"===e.config.origin||"bottom"===e.config.origin?e.config.axis="Y":e.config.axis="X"}function r(e){var t=window.getComputedStyle(e.domEl);e.styles||(e.styles={transition:{},transform:{},computed:{}},e.styles.inline=e.domEl.getAttribute("style")||"",e.styles.inline+="; visibility: visible; ",e.styles.computed.opacity=t.opacity,t.transition&&"all 0s ease 0s"!==t.transition?e.styles.computed.transition=t.transition+", ":e.styles.computed.transition=""),e.styles.transition.instant=s(e,0),e.styles.transition.delayed=s(e,e.config.delay),e.styles.transform.initial=" -webkit-transform:",e.styles.transform.target=" -webkit-transform:",a(e),e.styles.transform.initial+="transform:",e.styles.transform.target+="transform:",a(e)}function s(e,t){var n=e.config;return"-webkit-transition: "+e.styles.computed.transition+"-webkit-transform "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s, opacity "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s; transition: "+e.styles.computed.transition+"transform "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s, opacity "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s; "}function a(e){var t,n=e.config,i=e.styles.transform;t="top"===n.origin||"left"===n.origin?/^-/.test(n.distance)?n.distance.substr(1):"-"+n.distance:n.distance,parseInt(n.distance)&&(i.initial+=" translate"+n.axis+"("+t+")",i.target+=" translate"+n.axis+"(0)"),n.scale&&(i.initial+=" scale("+n.scale+")",i.target+=" scale(1)"),n.rotate.x&&(i.initial+=" rotateX("+n.rotate.x+"deg)",i.target+=" rotateX(0)"),n.rotate.y&&(i.initial+=" rotateY("+n.rotate.y+"deg)",i.target+=" rotateY(0)"),n.rotate.z&&(i.initial+=" rotateZ("+n.rotate.z+"deg)",i.target+=" rotateZ(0)"),i.initial+="; opacity: "+n.opacity+";",i.target+="; opacity: "+e.styles.computed.opacity+";"}function l(e){var t=e.config.container;t&&O.store.containers.indexOf(t)===-1&&O.store.containers.push(e.config.container),O.store.elements[e.id]=e}function c(e,t,n){var i={target:e,config:t,interval:n};O.history.push(i)}function f(){if(O.isSupported()){y();for(var e=0;e<O.store.containers.length;e++)O.store.containers[e].addEventListener("scroll",d),O.store.containers[e].addEventListener("resize",d);O.initialized||(window.addEventListener("scroll",d),window.addEventListener("resize",d),O.initialized=!0)}return O}function d(){T(y)}function u(){var e,t,n,i;O.tools.forOwn(O.sequences,function(o){i=O.sequences[o],e=!1;for(var r=0;r<i.elemIds.length;r++)n=i.elemIds[r],t=O.store.elements[n],q(t)&&!e&&(e=!0);i.active=e})}function y(){var e,t;u(),O.tools.forOwn(O.store.elements,function(n){t=O.store.elements[n],e=w(t),g(t)?(t.config.beforeReveal(t.domEl),e?t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.target+t.styles.transition.delayed):t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.target+t.styles.transition.instant),p("reveal",t,e),t.revealing=!0,t.seen=!0,t.sequence&&m(t,e)):v(t)&&(t.config.beforeReset(t.domEl),t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.initial+t.styles.transition.instant),p("reset",t),t.revealing=!1)})}function m(e,t){var n=0,i=0,o=O.sequences[e.sequence.id];o.blocked=!0,t&&"onload"===e.config.useDelay&&(i=e.config.delay),e.sequence.timer&&(n=Math.abs(e.sequence.timer.started-new Date),window.clearTimeout(e.sequence.timer)),e.sequence.timer={started:new Date},e.sequence.timer.clock=window.setTimeout(function(){o.blocked=!1,e.sequence.timer=null,d()},Math.abs(o.interval)+i-n)}function p(e,t,n){var i=0,o=0,r="after";switch(e){case"reveal":o=t.config.duration,n&&(o+=t.config.delay),r+="Reveal";break;case"reset":o=t.config.duration,r+="Reset"}t.timer&&(i=Math.abs(t.timer.started-new Date),window.clearTimeout(t.timer.clock)),t.timer={started:new Date},t.timer.clock=window.setTimeout(function(){t.config[r](t.domEl),t.timer=null},o-i)}function g(e){if(e.sequence){var t=O.sequences[e.sequence.id];return t.active&&!t.blocked&&!e.revealing&&!e.disabled}return q(e)&&!e.revealing&&!e.disabled}function w(e){var t=e.config.useDelay;return"always"===t||"onload"===t&&!O.initialized||"once"===t&&!e.seen}function v(e){if(e.sequence){var t=O.sequences[e.sequence.id];return!t.active&&e.config.reset&&e.revealing&&!e.disabled}return!q(e)&&e.config.reset&&e.revealing&&!e.disabled}function b(e){return{width:e.clientWidth,height:e.clientHeight}}function h(e){if(e&&e!==window.document.documentElement){var t=x(e);return{x:e.scrollLeft+t.left,y:e.scrollTop+t.top}}return{x:window.pageXOffset,y:window.pageYOffset}}function x(e){var t=0,n=0,i=e.offsetHeight,o=e.offsetWidth;do isNaN(e.offsetTop)||(t+=e.offsetTop),isNaN(e.offsetLeft)||(n+=e.offsetLeft),e=e.offsetParent;while(e);return{top:t,left:n,height:i,width:o}}function q(e){function t(){var t=c+a*s,n=f+l*s,i=d-a*s,y=u-l*s,m=r.y+e.config.viewOffset.top,p=r.x+e.config.viewOffset.left,g=r.y-e.config.viewOffset.bottom+o.height,w=r.x-e.config.viewOffset.right+o.width;return t<g&&i>m&&n>p&&y<w}function n(){return"fixed"===window.getComputedStyle(e.domEl).position}var i=x(e.domEl),o=b(e.config.container),r=h(e.config.container),s=e.config.viewFactor,a=i.height,l=i.width,c=i.top,f=i.left,d=c+a,u=f+l;return t()||n()}function E(){}var O,T;e.prototype.defaults={origin:"bottom",distance:"20px",duration:500,delay:0,rotate:{x:0,y:0,z:0},opacity:0,scale:.9,easing:"cubic-bezier(0.6, 0.2, 0.1, 1)",container:window.document.documentElement,mobile:!0,reset:!1,useDelay:"always",viewFactor:.2,viewOffset:{top:0,right:0,bottom:0,left:0},beforeReveal:function(e){},beforeReset:function(e){},afterReveal:function(e){},afterReset:function(e){}},e.prototype.isSupported=function(){var e=document.documentElement.style;return"WebkitTransition"in e&&"WebkitTransform"in e||"transition"in e&&"transform"in e},e.prototype.reveal=function(e,s,a,d){var u,y,m,p,g,w;if(void 0!==s&&"number"==typeof s?(a=s,s={}):void 0!==s&&null!==s||(s={}),u=t(s),y=n(e,u),!y.length)return O;a&&"number"==typeof a&&(w=i(),g=O.sequences[w]={id:w,interval:a,elemIds:[],active:!1});for(var v=0;v<y.length;v++)p=y[v].getAttribute("data-sr-id"),p?m=O.store.elements[p]:(m={id:i(),domEl:y[v],seen:!1,revealing:!1},m.domEl.setAttribute("data-sr-id",m.id)),g&&(m.sequence={id:g.id,index:g.elemIds.length},g.elemIds.push(m.id)),o(m,s,u),r(m),l(m),O.tools.isMobile()&&!m.config.mobile||!O.isSupported()?(m.domEl.setAttribute("style",m.styles.inline),m.disabled=!0):m.revealing||m.domEl.setAttribute("style",m.styles.inline+m.styles.transform.initial);return!d&&O.isSupported()&&(c(e,s,a),O.initTimeout&&window.clearTimeout(O.initTimeout),O.initTimeout=window.setTimeout(f,0)),O},e.prototype.sync=function(){if(O.history.length&&O.isSupported()){for(var e=0;e<O.history.length;e++){var t=O.history[e];O.reveal(t.target,t.config,t.interval,!0)}f()}return O},E.prototype.isObject=function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},E.prototype.isNode=function(e){return"object"==typeof window.Node?e instanceof window.Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},E.prototype.isNodeList=function(e){var t=Object.prototype.toString.call(e),n=/^\[object (HTMLCollection|NodeList|Object)\]$/;return"object"==typeof window.NodeList?e instanceof window.NodeList:e&&"object"==typeof e&&n.test(t)&&"number"==typeof e.length&&(0===e.length||this.isNode(e[0]))},E.prototype.forOwn=function(e,t){if(!this.isObject(e))throw new TypeError('Expected "object", but received "'+typeof e+'".');for(var n in e)e.hasOwnProperty(n)&&t(n)},E.prototype.extend=function(e,t){return this.forOwn(t,function(n){this.isObject(t[n])?(e[n]&&this.isObject(e[n])||(e[n]={}),this.extend(e[n],t[n])):e[n]=t[n]}.bind(this)),e},E.prototype.extendClone=function(e,t){return this.extend(this.extend({},e),t)},E.prototype.isMobile=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},T=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return e}):"undefined"!=typeof module&&module.exports?module.exports=e:window.ScrollReveal=e}(); | ||
!function(){"use strict";function e(n){return"undefined"==typeof this||Object.getPrototypeOf(this)!==e.prototype?new e(n):(O=this,O.version="3.3.6",O.tools=new E,O.isSupported()?(O.tools.extend(O.defaults,n||{}),O.defaults.container=t(O.defaults),O.store={elements:{},containers:[]},O.sequences={},O.history=[],O.uid=0,O.initialized=!1):"undefined"!=typeof console&&null!==console,O)}function t(e){if(e&&e.container){if("string"==typeof e.container)return window.document.documentElement.querySelector(e.container);if(O.tools.isNode(e.container))return e.container}return O.defaults.container}function n(e,t){return"string"==typeof e?Array.prototype.slice.call(t.querySelectorAll(e)):O.tools.isNode(e)?[e]:O.tools.isNodeList(e)?Array.prototype.slice.call(e):[]}function i(){return++O.uid}function o(e,t,n){t.container&&(t.container=n),e.config?e.config=O.tools.extendClone(e.config,t):e.config=O.tools.extendClone(O.defaults,t),"top"===e.config.origin||"bottom"===e.config.origin?e.config.axis="Y":e.config.axis="X"}function r(e){var t=window.getComputedStyle(e.domEl);e.styles||(e.styles={transition:{},transform:{},computed:{}},e.styles.inline=e.domEl.getAttribute("style")||"",e.styles.inline+="; visibility: visible; ",e.styles.computed.opacity=t.opacity,t.transition&&"all 0s ease 0s"!==t.transition?e.styles.computed.transition=t.transition+", ":e.styles.computed.transition=""),e.styles.transition.instant=s(e,0),e.styles.transition.delayed=s(e,e.config.delay),e.styles.transform.initial=" -webkit-transform:",e.styles.transform.target=" -webkit-transform:",a(e),e.styles.transform.initial+="transform:",e.styles.transform.target+="transform:",a(e)}function s(e,t){var n=e.config;return"-webkit-transition: "+e.styles.computed.transition+"-webkit-transform "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s, opacity "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s; transition: "+e.styles.computed.transition+"transform "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s, opacity "+n.duration/1e3+"s "+n.easing+" "+t/1e3+"s; "}function a(e){var t,n=e.config,i=e.styles.transform;t="top"===n.origin||"left"===n.origin?/^-/.test(n.distance)?n.distance.substr(1):"-"+n.distance:n.distance,parseInt(n.distance)&&(i.initial+=" translate"+n.axis+"("+t+")",i.target+=" translate"+n.axis+"(0)"),n.scale&&(i.initial+=" scale("+n.scale+")",i.target+=" scale(1)"),n.rotate.x&&(i.initial+=" rotateX("+n.rotate.x+"deg)",i.target+=" rotateX(0)"),n.rotate.y&&(i.initial+=" rotateY("+n.rotate.y+"deg)",i.target+=" rotateY(0)"),n.rotate.z&&(i.initial+=" rotateZ("+n.rotate.z+"deg)",i.target+=" rotateZ(0)"),i.initial+="; opacity: "+n.opacity+";",i.target+="; opacity: "+e.styles.computed.opacity+";"}function l(e){var t=e.config.container;t&&O.store.containers.indexOf(t)===-1&&O.store.containers.push(e.config.container),O.store.elements[e.id]=e}function c(e,t,n){var i={target:e,config:t,interval:n};O.history.push(i)}function f(){if(O.isSupported()){y();for(var e=0;e<O.store.containers.length;e++)O.store.containers[e].addEventListener("scroll",d),O.store.containers[e].addEventListener("resize",d);O.initialized||(window.addEventListener("scroll",d),window.addEventListener("resize",d),O.initialized=!0)}return O}function d(){T(y)}function u(){var e,t,n,i;O.tools.forOwn(O.sequences,function(o){i=O.sequences[o],e=!1;for(var r=0;r<i.elemIds.length;r++)n=i.elemIds[r],t=O.store.elements[n],q(t)&&!e&&(e=!0);i.active=e})}function y(){var e,t;u(),O.tools.forOwn(O.store.elements,function(n){t=O.store.elements[n],e=w(t),g(t)?(t.config.beforeReveal(t.domEl),e?t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.target+t.styles.transition.delayed):t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.target+t.styles.transition.instant),p("reveal",t,e),t.revealing=!0,t.seen=!0,t.sequence&&m(t,e)):v(t)&&(t.config.beforeReset(t.domEl),t.domEl.setAttribute("style",t.styles.inline+t.styles.transform.initial+t.styles.transition.instant),p("reset",t),t.revealing=!1)})}function m(e,t){var n=0,i=0,o=O.sequences[e.sequence.id];o.blocked=!0,t&&"onload"===e.config.useDelay&&(i=e.config.delay),e.sequence.timer&&(n=Math.abs(e.sequence.timer.started-new Date),window.clearTimeout(e.sequence.timer)),e.sequence.timer={started:new Date},e.sequence.timer.clock=window.setTimeout(function(){o.blocked=!1,e.sequence.timer=null,d()},Math.abs(o.interval)+i-n)}function p(e,t,n){var i=0,o=0,r="after";switch(e){case"reveal":o=t.config.duration,n&&(o+=t.config.delay),r+="Reveal";break;case"reset":o=t.config.duration,r+="Reset"}t.timer&&(i=Math.abs(t.timer.started-new Date),window.clearTimeout(t.timer.clock)),t.timer={started:new Date},t.timer.clock=window.setTimeout(function(){t.config[r](t.domEl),t.timer=null},o-i)}function g(e){if(e.sequence){var t=O.sequences[e.sequence.id];return t.active&&!t.blocked&&!e.revealing&&!e.disabled}return q(e)&&!e.revealing&&!e.disabled}function w(e){var t=e.config.useDelay;return"always"===t||"onload"===t&&!O.initialized||"once"===t&&!e.seen}function v(e){if(e.sequence){var t=O.sequences[e.sequence.id];return!t.active&&e.config.reset&&e.revealing&&!e.disabled}return!q(e)&&e.config.reset&&e.revealing&&!e.disabled}function b(e){return{width:e.clientWidth,height:e.clientHeight}}function h(e){if(e&&e!==window.document.documentElement){var t=x(e);return{x:e.scrollLeft+t.left,y:e.scrollTop+t.top}}return{x:window.pageXOffset,y:window.pageYOffset}}function x(e){var t=0,n=0,i=e.offsetHeight,o=e.offsetWidth;do isNaN(e.offsetTop)||(t+=e.offsetTop),isNaN(e.offsetLeft)||(n+=e.offsetLeft),e=e.offsetParent;while(e);return{top:t,left:n,height:i,width:o}}function q(e){function t(){var t=c+a*s,n=f+l*s,i=d-a*s,y=u-l*s,m=r.y+e.config.viewOffset.top,p=r.x+e.config.viewOffset.left,g=r.y-e.config.viewOffset.bottom+o.height,w=r.x-e.config.viewOffset.right+o.width;return t<g&&i>m&&n<w&&y>p}function n(){return"fixed"===window.getComputedStyle(e.domEl).position}var i=x(e.domEl),o=b(e.config.container),r=h(e.config.container),s=e.config.viewFactor,a=i.height,l=i.width,c=i.top,f=i.left,d=c+a,u=f+l;return t()||n()}function E(){}var O,T;e.prototype.defaults={origin:"bottom",distance:"20px",duration:500,delay:0,rotate:{x:0,y:0,z:0},opacity:0,scale:.9,easing:"cubic-bezier(0.6, 0.2, 0.1, 1)",container:window.document.documentElement,mobile:!0,reset:!1,useDelay:"always",viewFactor:.2,viewOffset:{top:0,right:0,bottom:0,left:0},beforeReveal:function(e){},beforeReset:function(e){},afterReveal:function(e){},afterReset:function(e){}},e.prototype.isSupported=function(){var e=document.documentElement.style;return"WebkitTransition"in e&&"WebkitTransform"in e||"transition"in e&&"transform"in e},e.prototype.reveal=function(e,s,a,d){var u,y,m,p,g,w;if(void 0!==s&&"number"==typeof s?(a=s,s={}):void 0!==s&&null!==s||(s={}),u=t(s),y=n(e,u),!y.length)return O;a&&"number"==typeof a&&(w=i(),g=O.sequences[w]={id:w,interval:a,elemIds:[],active:!1});for(var v=0;v<y.length;v++)p=y[v].getAttribute("data-sr-id"),p?m=O.store.elements[p]:(m={id:i(),domEl:y[v],seen:!1,revealing:!1},m.domEl.setAttribute("data-sr-id",m.id)),g&&(m.sequence={id:g.id,index:g.elemIds.length},g.elemIds.push(m.id)),o(m,s,u),r(m),l(m),O.tools.isMobile()&&!m.config.mobile||!O.isSupported()?(m.domEl.setAttribute("style",m.styles.inline),m.disabled=!0):m.revealing||m.domEl.setAttribute("style",m.styles.inline+m.styles.transform.initial);return!d&&O.isSupported()&&(c(e,s,a),O.initTimeout&&window.clearTimeout(O.initTimeout),O.initTimeout=window.setTimeout(f,0)),O},e.prototype.sync=function(){if(O.history.length&&O.isSupported()){for(var e=0;e<O.history.length;e++){var t=O.history[e];O.reveal(t.target,t.config,t.interval,!0)}f()}return O},E.prototype.isObject=function(e){return null!==e&&"object"==typeof e&&e.constructor===Object},E.prototype.isNode=function(e){return"object"==typeof window.Node?e instanceof window.Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},E.prototype.isNodeList=function(e){var t=Object.prototype.toString.call(e),n=/^\[object (HTMLCollection|NodeList|Object)\]$/;return"object"==typeof window.NodeList?e instanceof window.NodeList:e&&"object"==typeof e&&n.test(t)&&"number"==typeof e.length&&(0===e.length||this.isNode(e[0]))},E.prototype.forOwn=function(e,t){if(!this.isObject(e))throw new TypeError('Expected "object", but received "'+typeof e+'".');for(var n in e)e.hasOwnProperty(n)&&t(n)},E.prototype.extend=function(e,t){return this.forOwn(t,function(n){this.isObject(t[n])?(e[n]&&this.isObject(e[n])||(e[n]={}),this.extend(e[n],t[n])):e[n]=t[n]}.bind(this)),e},E.prototype.extendClone=function(e,t){return this.extend(this.extend({},e),t)},E.prototype.isMobile=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},T=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||function(e){window.setTimeout(e,1e3/60)},"function"==typeof define&&"object"==typeof define.amd&&define.amd?define(function(){return e}):"undefined"!=typeof module&&module.exports?module.exports=e:window.ScrollReveal=e}(); |
{ | ||
"name": "scrollreveal", | ||
"version": "3.3.5", | ||
"version": "3.3.6", | ||
"description": "Easy scroll animations for web and mobile browsers.", | ||
@@ -9,8 +9,2 @@ "homepage": "https://scrollrevealjs.org", | ||
"license": "MIT", | ||
"standard": { | ||
"globals": [ | ||
"ScrollReveal", | ||
"define" | ||
] | ||
}, | ||
"repository": { | ||
@@ -17,0 +11,0 @@ "type": "git", |
@@ -19,3 +19,3 @@ ///// ///// ///// ///// | ||
* ------------ | ||
* Version : 3.3.4 | ||
* Version : 3.3.6 | ||
* Website : scrollrevealjs.org | ||
@@ -39,3 +39,3 @@ * Repo : github.com/jlmakes/scrollreveal.js | ||
sr = this // Save reference to instance. | ||
sr.version = '3.3.4' | ||
sr.version = '3.3.6' | ||
sr.tools = new Tools() // *required utilities | ||
@@ -763,4 +763,4 @@ | ||
bottom > viewTop && | ||
left > viewLeft && | ||
right < viewRight | ||
left < viewRight && | ||
right > viewLeft | ||
} | ||
@@ -767,0 +767,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3234
355620