Ray's changes, put the js for upload image component in a separate file
This commit is contained in:
1 parent
b80339d704
commit
42aeaead93
2 files changed
+27
-26
No files matched your search
@@ -109,4 +109,29 @@ $.fn.imagesLoaded = function( callback ) {
|
||||
return deferred ? deferred.promise( $this ) : $this;
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.upload-picture').find('img').imagesLoaded(function(){
|
||||
var picH = $('.upload-picture').width()/$('.upload-picture').find('img').width()*$('.upload-picture').find('img').height();
|
||||
var imgMarginTop = ($('.upload-picture').height()-picH)/2;
|
||||
var d = $('.upload-picture').height();
|
||||
if(imgMarginTop>0){
|
||||
imgMarginTop = 0;
|
||||
d = picH;
|
||||
$('.upload-picture').css({height:d})
|
||||
}
|
||||
$('.upload-picture').find('img').css({marginTop:imgMarginTop})
|
||||
$('.upload-picture').each(function (i){
|
||||
$(this).mouseenter(function(){
|
||||
var h= picH;
|
||||
$(this).stop().animate({height:h}, 500);
|
||||
$(this).find('img').stop().animate({marginTop:0}, 500);
|
||||
});
|
||||
$(this).mouseleave(function(){
|
||||
$(this).stop().animate({height:d}, 500);
|
||||
$(this).find('img').stop().animate({marginTop:imgMarginTop}, 500);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user