test main_image code
This commit is contained in:
parent
480c72f742
commit
b881e47846
|
@ -88,13 +88,12 @@ class ItfModel(models.Model):
|
|||
|
||||
|
||||
def get_main_image(self):
|
||||
if not hasattr(self, 'main_image'):
|
||||
return {'thumb': None} #FIXME
|
||||
if hasattr(self, 'main_image'):
|
||||
main_image_getter = self.main_image
|
||||
if type(main_image_getter).__name__ == 'function':
|
||||
main_image = main_image_getter()
|
||||
if main_image is not None:
|
||||
imgfield = main_image
|
||||
imgfield = main_image_getter()
|
||||
else:
|
||||
imgfield = main_image_getter
|
||||
elif self.get_modelextra().default_image:
|
||||
imgfield = self.get_modelextra().default_image
|
||||
else:
|
||||
|
|
|
@ -44,7 +44,9 @@ $(function() {
|
|||
|
||||
$('.banner').click(function() {
|
||||
var link = $(this).attr("data-link");
|
||||
if ($.trim(link) != '') {
|
||||
location.href = link;
|
||||
}
|
||||
});
|
||||
|
||||
$('.buttons').click(function() {
|
||||
|
@ -54,12 +56,41 @@ $(function() {
|
|||
$t.addClass("buttonsSelected");
|
||||
$('.banner').hide();
|
||||
$('.banner').eq(buttonNo).show();
|
||||
clearTimeout(frontImageTimeout);
|
||||
cycleFrontImages = false;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/* for front images */
|
||||
var frontImageTimeout;
|
||||
$(function() {
|
||||
$('.banner').eq(0).show();
|
||||
$('#button0').addClass("buttonsSelected");
|
||||
frontImageTimeout = setTimeout(cycleFrontImage, 5000);
|
||||
// frontImageInterval = setInterval(cycleFrontImage, 1000);
|
||||
|
||||
});
|
||||
|
||||
cycleFrontImages = true;
|
||||
function cycleFrontImage() {
|
||||
// BOO = $('.buttonsSelected');
|
||||
var currImage = parseInt($('.buttonsSelected').attr("id").replace("button", ""));
|
||||
var currBanner = $('.banner').eq(currImage);
|
||||
if (currImage < ($('.buttons').length - 1)) {
|
||||
var nextImage = currImage + 1;
|
||||
} else {
|
||||
var nextImage = 0;
|
||||
}
|
||||
// console.log(nextImage);
|
||||
$('.banner').hide();
|
||||
$('.buttonsSelected').removeClass("buttonsSelected");
|
||||
$('.banner').eq(nextImage).show();
|
||||
$('#button' + nextImage).addClass("buttonsSelected");
|
||||
if (cycleFrontImages) frontImageTimeout = setTimeout(cycleFrontImage, 10000);
|
||||
}
|
||||
|
||||
|
||||
var ItfSlider = function(o) {
|
||||
var opts = $.extend({
|
||||
|
@ -121,33 +152,3 @@ ItfSlider.prototype.moveRight = function(distance, speed) {
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
/* for front images */
|
||||
var frontImageInterval;
|
||||
$(function() {
|
||||
$('.banner').eq(0).show();
|
||||
$('#button0').addClass("buttonsSelected");
|
||||
setTimeout(cycleFrontImage, 5000);
|
||||
// frontImageInterval = setInterval(cycleFrontImage, 1000);
|
||||
|
||||
});
|
||||
|
||||
cycleFrontImages = true;
|
||||
function cycleFrontImage() {
|
||||
// BOO = $('.buttonsSelected');
|
||||
var currImage = parseInt($('.buttonsSelected').attr("id").replace("button", ""));
|
||||
var currBanner = $('.banner').eq(currImage);
|
||||
if (currImage < ($('.buttons').length - 1)) {
|
||||
var nextImage = currImage + 1;
|
||||
} else {
|
||||
var nextImage = 0;
|
||||
}
|
||||
// console.log(nextImage);
|
||||
$('.banner').hide();
|
||||
$('.buttonsSelected').removeClass("buttonsSelected");
|
||||
$('.banner').eq(nextImage).show();
|
||||
$('#button' + nextImage).addClass("buttonsSelected");
|
||||
if (cycleFrontImages) setTimeout(cycleFrontImage, 10000);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user