SImplify thumbslist

This commit is contained in:
Ruud
2013-05-03 22:29:33 +02:00
parent 6f808fc25a
commit 46c408befb
3 changed files with 79 additions and 19 deletions
+32 -1
View File
@@ -46,7 +46,7 @@ Page.Home = new Class({
self.soon_list = new MovieList({
'navigation': false,
'identifier': 'soon',
'limit': 18,
'limit': 12,
'title': 'Available soon',
'description': 'These are being searched for and should be available soon as they will be released on DVD in the next few weeks.',
'on_empty_element': new Element('div').adopt(
@@ -63,6 +63,37 @@ Page.Home = new Class({
'api_call': 'dashboard.soon'
});
// Make all thumbnails the same size
self.soon_list.addEvent('loaded', function(){
var images = $(self.soon_list).getElements('img'),
timer,
lowest = null;
images.addEvent('load', function(){
var height = this.getSize().y;
if(!lowest || lowest > height){
lowest = height;
if(timer) clearTimeout(timer);
timer = (function(){
images.getParent().setStyle('height', lowest);
}).delay(300)
}
});
$(window).addEvent('resize', function(){
if(timer) clearTimeout(timer);
timer = (function(){
var lowest;
images.each(function(img){
var height = img.getSize().y;
if(!lowest || lowest > height)
lowest = height;
});
images.getParent().setStyle('height', lowest);
}).delay(300);
});
});
// Still not available
self.late_list = new MovieList({
'navigation': false,