From ef5b4aaca99b811d0399f40d4ca79c642cf6bf31 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 19 Nov 2015 20:56:10 -0500 Subject: ClosedStoreView --- StoneIsland/www/js/lib/products/ClosedStoreView.js | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 StoneIsland/www/js/lib/products/ClosedStoreView.js (limited to 'StoneIsland/www/js/lib/products') diff --git a/StoneIsland/www/js/lib/products/ClosedStoreView.js b/StoneIsland/www/js/lib/products/ClosedStoreView.js new file mode 100644 index 00000000..02e7b312 --- /dev/null +++ b/StoneIsland/www/js/lib/products/ClosedStoreView.js @@ -0,0 +1,43 @@ +var ClosedStoreView = new View ({ + + el: "#closed", + + events: { + "click .website_link": "website_link", + }, + + delay: 8000, + + timeout: -1, + images: null, + + initialize: function(){ + this.loader = new Loader () + }, + + show: function(){ + this.animate() + }, + + hide: function(){ + clearTimeout(this.timeout) + }, + + animate: function(){ + this.timeout = setTimeout(this.animate.bind(this), this.delay) + if (! this.images) return + var url = choice(this.images) + this.loader.preloadImage(url, function(img){ + this.el.style.backgroundImage = 'url(' + img.src + ')' + }.bind(this)) + }, + + populate: function(data){ + this.images = data.map(function(img){ return img.uri }) + }, + + website_link: function(){ + window.open("http://www.stoneisland.com/", '_system') + }, + +}) \ No newline at end of file -- cgit v1.2.3-70-g09d2