diff --git a/CHANGELOG.md b/CHANGELOG.md index 896ee03f..3cab4613 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,21 @@ ###### scrollReveal.js Changelog +### v0.0.4 February 28th, 2014 + +* scrollReveal no longer destroys the existing `style` attribute on revealed elements, but instead, now ammends the necessary reveal animation styles after any existing styles. **(Fixes #18)** + +>**Note:** scrollReveal will still override any existing transition or transform in the `style` attribute. + ### v0.0.3 February 22th, 2014 -* removed `-moz-` & `-o-` from css transitions & transforms +* removed unecessary styles (with `-moz-` & `-o-`) from css transitions & transforms * added top-line comment, intending it to be kept after minification ### v0.0.2 February 13th, 2014 +* Added CHANGELOG +* Improved README + What’s New ---------- #### Manual Instantiation diff --git a/bower.json b/bower.json index 5d8595d6..75a845ca 100644 --- a/bower.json +++ b/bower.json @@ -1,17 +1,20 @@ { "name": "scrollReveal.js", - "version": "0.0.3", + "version": "0.0.4", "homepage": "https://github.com/julianlloyd/scrollReveal.js", "authors": [ - "Julian Lloyd " + "Julian Lloyd " ], "description": "A simple way to create and maintain how elements fade in, triggered when they enter the viewport.", "main": ["scrollReveal.js"], "keywords": [ + "scrollReveal", "animation", "CSS", "transition", - "JavaScript" + "JavaScript", + "scroll", + "reveal" ], "license": "MIT", "ignore": [ diff --git a/scrollReveal.js b/scrollReveal.js index d34cf3d8..1cd002ca 100644 --- a/scrollReveal.js +++ b/scrollReveal.js @@ -1,11 +1,10 @@ -/*! scrollReveal.js v0.0.3 | (c)2014 Julian Lloyd | MIT license */ /* _ _ _____ _ _ | | | __ \ | | (_) ___ ___ _ __ ___ | | | |__) |_____ _____ __ _| | _ ___ / __|/ __| '__/ _ \| | | _ // _ \ \ / / _ \/ _` | | | / __| \__ \ (__| | | (_) | | | | \ \ __/\ V / __/ (_| | |_| \__ \ - |___/\___|_| \___/|_|_|_| \_\___| \_/ \___|\__,_|_(_) |___/ v.0.0.2 + |___/\___|_| \___/|_|_|_| \_\___| \_/ \___|\__,_|_(_) |___/ v.0.0.4 _/ | |__/ @@ -18,10 +17,13 @@ Licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php - scrollReveal.js (c) 2014 Julian Lloyd - =============================================================================*/ +/*! scrollReveal.js v0.0.4 (c) 2014 Julian Lloyd | MIT license */ + +/*===========================================================================*/ + + window.scrollReveal = (function (window) { 'use strict'; @@ -194,16 +196,19 @@ window.scrollReveal = (function (window) { /*=============================================================================*/ update: function (el) { - var css = this.genCSS(el); + var css = this.genCSS(el); + var style = el.getAttribute('style'); + + if (style != null) style += ";"; else style = ""; if (!el.getAttribute('data-scrollReveal-initialized')) { - el.setAttribute('style', css.initial); + el.setAttribute('style', style + css.initial); el.setAttribute('data-scrollReveal-initialized', true); } if (!this.isElementInViewport(el, this.options.viewportFactor)) { if (this.options.reset) { - el.setAttribute('style', css.initial + css.reset); + el.setAttribute('style', style + css.initial + css.reset); } return; } @@ -211,12 +216,16 @@ window.scrollReveal = (function (window) { if (el.getAttribute('data-scrollReveal-complete')) return; if (this.isElementInViewport(el, this.options.viewportFactor)) { - el.setAttribute('style', css.target + css.transition); + el.setAttribute('style', style + css.target + css.transition); // Without reset enabled, we can safely remove the style tag // to prevent CSS specificy wars with authored CSS. if (!this.options.reset) { setTimeout(function () { - el.removeAttribute('style'); + if (style != "") { + el.setAttribute('style', style); + } else { + el.removeAttribute('style'); + } el.setAttribute('data-scrollReveal-complete',true); }, css.totalDuration); }