var timer = null; var offset = 5000; var index = 0; function $j(elmid) { return $("#" + elmid); } $(function () { var count = $("#newsnum").html(); //change opacity //$('div.word').css({ opacity: 0.85 }); //auto(); hookthumb(count); //hookbtn(); newhookbtn(count); bighookbtn(count); slideimage(0) }); /* |xgv00|d7b30c0224cec55b59311c4f2af116f7 */ //��ͼ�����ֻ� function slideimage(i) { var id = 'image_' + target[i]; // $('#' + id) // .animate({ opacity: 1 }, 800, function () { // $(this).find('.word').animate({ height: 'show' }, 'slow'); // }).show() // .siblings(':visible') // .find('.word').animate({ height: 'hide' }, 'fast', function () { // $(this).parent().animate({ opacity: 0 }, 800).hide(); // }); var newid = target2[i]; $.post("/ajax.ashx?action=slideimage&t=" + math.random(), { newid: newid }, function (msg) { $("#newsdetail").html(msg); }); } //bind thumb a function hookthumb(count) { $('#thumbs li a') .bind('click', function () { // if (timer) { // cleartimeout(timer); // } var id = this.id; index = getindex(id.substr(6)); //newid = getnewid(id.substr(6)); rechange(index); slideimage(index); if (count == index + 1) { $(".btnext").hide(); $(".bigbtnnext").hide(); } else { $(".btnext").show(); $(".bigbtnnext").show(); } //timer = window.settimeout(auto, offset); this.blur(); return false; }); } //bind next/prev img //function hookbtn() { // $('#thumbs li img').filter('#play_prev,#play_next') // .bind('click', function () { // if (timer) { // cleartimeout(timer); // } // var id = this.id; // if (id == 'play_prev') { // index--; // if (index < 0) index = 9; // } else { // index++; // if (index > 9) index = 0; // } // rechange(index); // slideimage(index); // timer = window.settimeout(auto, offset); // }); //} //get index function getindex(v) { for (var i = 0; i < target.length; i++) { if (target[i] == v) return i; } } function rechange(loop) { var id = 'thumb_' + target[loop]; $('#thumbs li a.current').removeclass('current'); $('#' + id).addclass('current'); } function bighookbtn(count) { $('#bigpicarea p span').filter('#big_play_prev,#big_play_next') .bind('click', function () { // if (timer) { // cleartimeout(timer); // } var id = this.id; if (id == 'big_play_prev') { if (index != 0 && (index) % 6 == 0) { scrollss(-660); } index--; if (index <= 0) index = 0; if (count > index) { $(".btnext").show(); $(".bigbtnnext").show(); } } else { if (index != 0 && (index + 1) % 6 == 0) { scrollss(660); } index++; if (index > count) index = count; if (count == index + 1) { $(".btnext").hide(); $(".bigbtnnext").hide(); } } if (count >= index + 1) { rechange(index); slideimage(index); } //timer = window.settimeout(auto, offset); }); } function newhookbtn(count) { $('#smallpicarea img').filter('#play_prev,#play_next') .bind('click', function () { // if (timer) { // cleartimeout(timer); // } var id = this.id; if (id == 'play_prev') { if (index != 0 && (index) % 6 == 0) { scrollss(-660); } index--; if (index <= 0) index = 0; if (count > index) { $(".btnext").show(); $(".bigbtnnext").show(); } } else { if (index != 0 && (index + 1) % 6 == 0) { scrollss(660); } index++; if (index > count) index = count; if (count == index + 1) { $(".btnext").hide(); $(".bigbtnnext").hide(); } } if (count > index) { rechange(index); slideimage(index); } //timer = window.settimeout(auto, offset); }); } function scrollss(n) { tempding = n; document.getelementbyid('thumbs').scrollleft = document.getelementbyid('thumbs').scrollleft + tempding; } function auto() { index++; if (index > count) { index = 0; } rechange(index); slideimage(index); //timer = window.settimeout(auto, offset); }