Merge branch 'design_team' of github.com:Rulingcom/orbit into design_team
This commit is contained in:
commit
8bf55a184e
|
@ -110,3 +110,28 @@ $.fn.imagesLoaded = function( callback ) {
|
|||
};
|
||||
|
||||
})(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);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -78,31 +78,7 @@
|
|||
<div class="control-group">
|
||||
<div class="upload-picture">
|
||||
<!--請程式務必將圖片尺寸加入到行內裡-->
|
||||
<%= image_tag @ad_image.file,:width=> "456",:height=>'700' rescue ''%>
|
||||
<script type="text/javascript">
|
||||
$('.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);
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<%= image_tag @ad_image.file rescue ''%>
|
||||
</div>
|
||||
<span class="alert widgetInfo">此區塊圖片尺寸請使用580px × 225px</span>
|
||||
<div class="controls file-upload input-prepend">
|
||||
|
|
Loading…
Reference in New Issue