////////////////////////////////////////////////////////////////////////////////////// // // // Everlax // //----------------------------------------------------------------------------------// // created by: Mark Nelson // // version: 1.0 // // download: https://github.com/DataDink/Everlax // // site: http://datadink.github.io/Everlax/ // // docs: http://datadink.github.io/Everlax/about/ // // // ////////////////////////////////////////////////////////////////////////////////////// // Polyfills - potentially missing javascript functionality if (!String.prototype.endsWith) { String.prototype.endsWith = function(suffix) { return !suffix || this.indexOf(suffix, this.length - suffix.length) !== -1; }; } if (!String.prototype.trim) { String.prototype.trim = function() { return this.replace(/$\s+|\s+^/gi, ''); } } // Plugin // -- Functional Overview: // * Gather all background image URLs, background-position values, and background-size values // * 'Load' each image in order to determine size. // * Upon image-load, calculate start and end positions for each background image. // -- Calculation Overview: // * Based on height, width, and angle (a square at 45 degress will travel at approx 45 degrees - rectangle will not) // * Adjust final end points to the closest "repeat" point. (This will likely alter the actual direction a small amount) (function ($) { var styleSheet = $('