orbit-basic/app/views/front/show_banner.html.erb

26 lines
1.2 KiB
Plaintext

<div style='position:relative'>
<div id='slideshow-<%= @ad_banner.title.dehumanize %>' class="orbit-cycle-slideshow" data-cycle-timeout="<%= @ad_banner.timeout_millisecond %>" 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">
<% @ad_banner.ad_images.can_display.each do |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?}" %>
<% end %>
</div>
<ul class='clear banner_nav banner_nav_<%= @ad_banner.title.dehumanize %>'></ul>
</div>
<script>
$(function(){
if($("#slideshow-<%= @ad_banner.title.dehumanize %> img").length > 1){
var a = [];
<% @ad_banner.ad_images.can_display.each do |image| %>
a.push("<%= image.file.url %>");
<% end %>
$.preload(a, 2, function(){
$('.orbit-cycle-slideshow').cycle();
});
}
else{
$("#slideshow-<%= @ad_banner.title.dehumanize %> img").show()
}
});
</script>