像这样的代码(上传图片时执行):
gallery = Gallery.objects.get(id=album_id)
index = gallery.photo_num +1 #index will be used in later
gallery.photo_num = index
gallery.save()
1张图片上传效果很好,但如果同时上传多张图片,使用多张上传jQuery plugin.the "gallery.photo_num“会比较混乱
如何修改代码以避免此问题
如何测试一张图片是一组图片中的第一张还是最后一张?
我尝试使用下面的代码,根据我是否在一系列图像的末尾,来设置上一个和下一个按钮的动画效果:
var $current = jQuery("img .active");
var $next = $current.next();
if ($next != jQuery("img:first-child")
{
// show next item and the previous button
// seems to work?
} else if ($next == jQuery("img:last-
我想创造一个无限的效果,就像画廊上的carrousel。我已经使用了一个插件+很多jquery,所以我尽量避免使用carrousel插件,而是自己来做。
我检测了第一张图片的位置,并添加了一段代码,如果人们点击上一张图片会产生无限的效果,就会在第一张图片前面插入最后一张图片。
$('#fp_prev_thumb').click(function(){
//position of the first thumb
var offset2 = $('.firstThumb').offset();
var pos_first = offset2.