1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
| var banners = 1; var timer;
function loads() {
var img_num = banner_max $(".banner_img" + banners).fadeTo(100, 1);
var numbers_span = ""; for (var i = 1; i <= img_num; ++i) { numbers_span += '<span class="num' + i + '" onclick="manual_replace_banner(' + i + ')">' + i + '</span>'; }
$(".numbers").html(numbers_span);
var banners_height = $(".banners").height(); $(".banners").css("line-height", banners_height + "px");
}
$(window).resize(function () {
var banners_height = $(".banners").height(); $(".banners").css("line-height", banners_height + "px");
});
$(document).ready(function () {
banner_number();
timer = setInterval(auto_replace_banner, speed * 1000);
});
function banner_left_right(sj) { var sjs;
if (sj == "left") { if (banners == 1) { sjs = banner_max; } else { sjs = banners - 1; } } else { if (banners == banner_max) { sjs = 1; } else { sjs = banners + 1; } }
manual_replace_banner(sjs); }
function manual_replace_banner(sj) { var bannerz = banners;
banners = sj;
if (banners == bannerz) { return; }
clearInterval(timer);
fade_in_out(bannerz, banners);
timer = setInterval(auto_replace_banner, speed * 1000); }
function auto_replace_banner() { var bannerz = banners;
if (banners == banner_max) { banners = 1; } else { banners += 1; }
fade_in_out(bannerz, banners); }
function fade_in_out(bannerz, banners) { var out_id = ".banner_img" + bannerz; var banner_out = $(out_id);
var in_id = ".banner_img" + banners; var bannet_in = $(in_id);
banner_out.fadeTo(600, 0); bannet_in.fadeTo(500, 1);
banner_number(); }
function banner_number() { for (var i = 1; i <= banner_max; i++) { var num_id = ".num" + i; var num_object = $(num_id); if (banners == i) { num_object.css("color", "black"); num_object.css("backgroundColor", "white"); } else { num_object.css("color", "white"); num_object.css("backgroundColor", "rgba(0,0,0,0)"); } } }
function link(url, mode = true) { if (mode == true) { window.open(url); } else { window.location.href = url; } }
loads();
|