summaryrefslogtreecommitdiff
path: root/StoneIsland/www/js/lib/products
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-12-11 04:24:13 -0600
committerJules Laplace <jules@okfoc.us>2015-12-11 04:24:13 -0600
commit190e24251c17733eff8fc1b11a077ca2da4b6c4f (patch)
treeeef5d4175d41f7296a4a64918d4e50192a496143 /StoneIsland/www/js/lib/products
parent0e070756a7e66975fe381577e93dd5f709017bf7 (diff)
rebuild
Diffstat (limited to 'StoneIsland/www/js/lib/products')
-rwxr-xr-xStoneIsland/www/js/lib/products/ClosedStoreView.js20
1 files changed, 16 insertions, 4 deletions
diff --git a/StoneIsland/www/js/lib/products/ClosedStoreView.js b/StoneIsland/www/js/lib/products/ClosedStoreView.js
index 5f8c1e84..6f7b8486 100755
--- a/StoneIsland/www/js/lib/products/ClosedStoreView.js
+++ b/StoneIsland/www/js/lib/products/ClosedStoreView.js
@@ -12,6 +12,7 @@ var ClosedStoreView = View.extend({
timeout: -1,
images: null,
+ images_loaded: {},
initialize: function(){
this.loader = new Loader ()
@@ -21,7 +22,6 @@ var ClosedStoreView = View.extend({
document.body.className = "closed"
this.animate()
app.footer.hide()
- console.log(this)
if (this.storeOpenDate) {
var date = moment(this.storeOpenDate).format("MM/DD")
console.log(date)
@@ -38,15 +38,27 @@ var ClosedStoreView = View.extend({
animate: function(){
this.timeout = setTimeout(this.animate.bind(this), this.delay)
+ this.next()
+ },
+
+ next: function(){
if (! this.images) return
var url = choice(this.images)
- this.loader.preloadImage(url, function(img){
- this.el.style.backgroundImage = 'url(' + img.src + ')'
- }.bind(this))
+
+ if (this.images_loaded[url]) {
+ this.el.style.backgroundImage = 'url(' + url + ')'
+ }
+ else {
+ this.loader.preloadImage(url, function(img){
+ this.el.style.backgroundImage = 'url(' + url + ')'
+ this.images_loaded[url] = true
+ }.bind(this))
+ }
},
populate: function(data){
this.images = data.map(function(img){ return img.uri })
+ this.next()
},
website_link: function(){