small fix for banner pagination.

This commit is contained in:
Harry Bomrah 2013-11-11 16:44:50 +08:00 committed by saurabhbhatia
parent 5e0696890a
commit 405c2c5a12
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<div style='position:relative'> <div style='position:relative'>
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="orbit-cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_millisecond %>" data-cycle-fx="<%= @ad_banner.ad_fx %>" data-cycle-pager=".banner_nav_<%= @ad_banner.title.dehumanize %>" data-cycle-pager-template="<li><a href='#'></a></li>" data-cycle-pager-active-class="activeSlide" data-cycle-random='true' style="z-index: 0"> <div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="orbit-cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_millisecond %>" data-cycle-fx="<%= @ad_banner.ad_fx %>" data-cycle-pager=".banner_nav_<%= @ad_banner.title.dehumanize %>" data-cycle-pager-template="<li class='needed'><a href='#'></a></li>" data-cycle-pager-active-class="activeSlide" data-cycle-random='true' style="z-index: 0">
<% @ad_banner.ad_images.can_display.each do |ad_image| %> <% @ad_banner.ad_images.can_display.each do |ad_image| %>
<% link = ad_image_link(ad_image) %> <% link = ad_image_link(ad_image) %>
<%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %> <%= image_tag ad_image.file, width: @ad_banner.width, height: @ad_banner.height, link_open: ad_image.link_open, link_url: link, style: "display:none; #{'cursor:pointer;' if link.present?}" %>
@ -17,6 +17,12 @@
<% end %> <% end %>
$.preload(a, 2, function(){ $.preload(a, 2, function(){
$('.orbit-cycle-slideshow').cycle(); $('.orbit-cycle-slideshow').cycle();
var lis = $("ul.banner_nav_<%= @ad_banner.title.dehumanize %> li");
if( lis.length > a.length ){
for( i = lis.length - 1; i > a.length - 1; i-- ){
lis[i].remove();
}
}
}); });
} }
else{ else{