Skip to content

Commit

Permalink
fixed overflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Humphreys committed Jun 17, 2011
1 parent 2497129 commit 233c861
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 24 deletions.
36 changes: 24 additions & 12 deletions js/flickrbomb-demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ startFlickrBomb = function () {
});
},

nextPage: function () {
nextPage: function (callback) {
this.page += 1;
this.remove(this.models);
this.fetch();
this.fetch(null, callback);
},

prevPage: function() {
if (this.page > 1) this.page -= 1;
prevPage: function(callback) {
if (this.page > 1) {this.page -= 1;}
this.remove(this.models);
this.fetch();
this.fetch(null, callback);
}

}),
Expand Down Expand Up @@ -150,7 +150,9 @@ startFlickrBomb = function () {
tagName: "div",

className: "flickrbombContainer",


lock: false,

template: _.template('<div id="<%= this.image.id.replace(" ","") %>" class="flickrbombWrapper"><img class="flickrbomb" src="" /><a href="#" title="Setup" class="setupIcon"></a></div><div class="flickrbombFlyout"><div class="content"><a href="#" title="Previous Page" class="prev">&#9664;</a><a href="#" title="Next Page" class="next">&#9654;</a></div></div>'),

initialize: function (options) {
Expand Down Expand Up @@ -254,15 +256,25 @@ startFlickrBomb = function () {

nextFlickrPhotos: function (event) {
event.preventDefault();

this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.nextPage();
var self = this;
if(!this.lock) {
this.lock = true;
this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.nextPage(function() {
self.lock = false;
});
}
},
prevFlickrPhotos: function (event) {
event.preventDefault();

this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.prevPage();
var self = this;
if(!this.lock) {
this.lock = true;
this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.prevPage(function() {
self.lock = false;
});
}
},

resize: function () {
Expand Down
36 changes: 24 additions & 12 deletions js/flickrbomb.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,16 @@ var flickrbombAPIkey = '66b5c17019403c96779e8fe88d5b576d', //your Flickr API ke
});
},

nextPage: function () {
nextPage: function (callback) {
this.page += 1;
this.remove(this.models);
this.fetch();
this.fetch(null, callback);
},

prevPage: function() {
if (this.page > 1) this.page -= 1;
prevPage: function(callback) {
if (this.page > 1) {this.page -= 1;}
this.remove(this.models);
this.fetch();
this.fetch(null, callback);
}

}),
Expand Down Expand Up @@ -149,7 +149,9 @@ var flickrbombAPIkey = '66b5c17019403c96779e8fe88d5b576d', //your Flickr API ke
tagName: "div",

className: "flickrbombContainer",


lock: false,

template: _.template('<div id="<%= this.image.id.replace(" ","") %>" class="flickrbombWrapper"><img class="flickrbomb" src="" /><a href="#" title="Setup" class="setupIcon"></a></div><div class="flickrbombFlyout"><div class="content"><a href="#" title="Previous Page" class="prev">&#9664;</a><a href="#" title="Next Page" class="next">&#9654;</a></div></div>'),

initialize: function (options) {
Expand Down Expand Up @@ -253,15 +255,25 @@ var flickrbombAPIkey = '66b5c17019403c96779e8fe88d5b576d', //your Flickr API ke

nextFlickrPhotos: function (event) {
event.preventDefault();

this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.nextPage();
var self = this;
if(!this.lock) {
this.lock = true;
this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.nextPage(function() {
self.lock = false;
});
}
},
prevFlickrPhotos: function (event) {
event.preventDefault();

this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.prevPage();
var self = this;
if(!this.lock) {
this.lock = true;
this.$('.flickrbombFlyout').find('a.photo').remove();
this.image.flickrImages.prevPage(function() {
self.lock = false;
});
}
},

resize: function () {
Expand Down

0 comments on commit 233c861

Please sign in to comment.