Fix Ad_Banner Loading Problem (Not complete)
This commit is contained in:
parent
fac578f251
commit
9c41282fdb
|
@ -10,18 +10,9 @@
|
|||
</div>
|
||||
</div>
|
||||
<script type='text/javascript'>
|
||||
$(document).ready(function(){
|
||||
jQuery(function( $ ){
|
||||
|
||||
$('#slideshow-<%= @ad_banner.title.dehumanize %>').cycle({
|
||||
delay: -1000,
|
||||
fx: "<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
timeoutFn: getTimeout,
|
||||
pager: '.banner_nav-<%= @ad_banner.title.dehumanize %>',
|
||||
pagerAnchorBuilder: function(idx, slide) {
|
||||
return "<li><a href='#'></a></li>";
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
var banner = {"banner_name":"#slideshow-<%= @ad_banner.title.dehumanize %>",
|
||||
"banner_fx":"<%= @ad_banner.ad_fx.nil? ? 'fade': @ad_banner.ad_fx %>",
|
||||
"banner_pager":".banner_nav-<%= @ad_banner.title.dehumanize %>"
|
||||
};
|
||||
banners.push(banner);
|
||||
</script>
|
||||
|
|
|
@ -1,23 +1,45 @@
|
|||
var banners = [];
|
||||
var banner_index = 0;
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$.each($(".dymanic_load"),function(){
|
||||
if($(this).attr("path")==''){$(this).html("App setting Failed");}
|
||||
|
||||
if($(this).attr("path")!=''){
|
||||
ajax_load_proc($(this),$(this).attr("path"));
|
||||
}
|
||||
if($(this).attr("path").indexOf("show_banner")>0){
|
||||
ajax_load_proc($(this),$(this).attr("path"),"true");
|
||||
}else{
|
||||
ajax_load_proc($(this),$(this).attr("path"),$(this).attr("path"));
|
||||
}
|
||||
);
|
||||
}});
|
||||
$("#main_content").addClass("module");
|
||||
});
|
||||
});
|
||||
|
||||
function ajax_load_proc(wapper,url){
|
||||
function ajax_load_proc(wapper,url,isBanner){
|
||||
$.get(encodeURI(url), {}, function(respText,textSta,XML){
|
||||
if (textSta == 'success') {
|
||||
wapper.html(respText);
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
if (textSta == 'success') {
|
||||
if(isBanner=="true"){
|
||||
wapper.html(respText);
|
||||
setTimeout("BannerCycle()", 2500);
|
||||
}else{
|
||||
wapper.html(respText);
|
||||
}
|
||||
};
|
||||
if(textSta == 'error')
|
||||
wapper.html("Loading Failed<br/> <a href='"+$(this).attr('path')+"'>Go See</a>");
|
||||
});
|
||||
}
|
||||
|
||||
function BannerCycle(){
|
||||
var banner = banners[banner_index];
|
||||
banner_index++;
|
||||
$(banner.banner_name).ready(function() {
|
||||
$(banner.banner_name).cycle({
|
||||
delay: -1000,
|
||||
fx: banner.banner_fx,
|
||||
timeoutFn: getTimeout,
|
||||
pager: banner.banner_pager,
|
||||
pagerAnchorBuilder: function(idx, slide) { return "<li><a href='#'></a></li>"; }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue