滚动栏效果调整

This commit is contained in:
Tim 2016-05-04 15:43:46 +08:00
parent 80ff421853
commit 51ff1b0aa6
1 changed files with 52 additions and 35 deletions

View File

@ -13,48 +13,50 @@
<h2 class="h2-title">合作伙伴<a href="javascript:void(0);" target="_blank" class="more">更多</a></h2>
<div class="sn-index-partnerbox " >
<ul id="scrollPic" >
<div style="width: 760px;">
<% org_acts.first(8).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<% if iamge_path.nil? %>
<li><%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "partnerimg" %></li>
<% else %>
<li><%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "partnerimg" %></li>
<% end %>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "partnerimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "partnerimg" %>
<% end %>
<div class="scroll-control">
<div class="scroll-container">
<% org_acts.first(8).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %>
<% flag = 2 %>
<% iamge_path = get_image_path_from_content(document.content) %>
<% if iamge_path.nil? %>
<li class="sn-fl"><%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "partnerimg" %></li>
<% else %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank", :class => "partnerimg" %>
<li class="sn-fl"><%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank", :class => "partnerimg" %></li>
<% end %>
<% elsif activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "partnerimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), board_message_url_in_org(message.board.id,message.id), :target => "_blank", :class => "partnerimg" %>
<% end %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank", :class => "partnerimg" %>
<% iamge_path = get_image_path_from_content(message.content) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank", :class => "partnerimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "370", :height => "220"), board_message_path(message.board,activity), :target => "_blank", :class => "partnerimg" %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), news_path(news), :target => "_blank", :class => "partnerimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), news_path(news), :target => "_blank", :class => "partnerimg" %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<% if iamge_path.nil? %>
<%= link_to image_tag("/images/default_blank/ad-default.jpg", :width => "368", :height => "43"), news_path(news), :target => "_blank", :class => "partnerimg" %>
<% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "368", :height => "43"), news_path(news), :target => "_blank", :class => "partnerimg" %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
</div>
</ul>
<div class="cl"></div>
@ -83,3 +85,18 @@
</div>
<% end %>
<% end %>
<script>
$(document).ready(function(){
var num = $(".scroll-container").children().size();
var num = Math.round(num/4);
var divWidth = 380*num;
$(".scroll-container").css("width",divWidth).css("height",110);
if(num%2 != 0) {
var controlWidth = 380*num + 380;
}else{
var controlWidth = 380*num;
}
$(".scroll-control").css("width",controlWidth);
});
</script>