// JavaScript Document //obj1 对象,speed停留时间,speed切换速度, ShowType 切换方式 0为渐变 ,1为切换 ShowText 1显示文本 0为不显示文字,ShowMun 1 显示数字,2显示缩略图,其他不显示,direction 切换方向,5为左右轮流,6上下轮流,speed1切换速度,showp是否显示左右方向滚动箭头 由NET112编写 ,官方网址http://www.net112.net //play("#play",2000,1,1,1,3,width,height, speed1,showp); //top_ad(strng, startdate, stoptime, date1, date2)顶部广告 //auto(tmp)//自适应触发 //float(obj, itop) //两侧对联广告 //$("#cms1 .content embed[src$='.flv']").each(function(){ //var auto=0; //if($(this).attr("autostart")=="false"){auto=1} //flv($(this),$(this).attr("src"),"",$(this).attr("width"),$(this).attr("height"),auto); //}) // JavaScript Document //obj1 对象,speed停留时间,speed切换速度, ShowType 切换方式 0为渐变 ,1为切换 ShowText 1显示文本 0为不显示文字,ShowMun 1 显示数字,2显示缩略图,其他不显示,direction 切换方向,5为左右轮流,6上下轮流,speed1切换速度,showp是否显示左右方向滚动箭头 由NET112编写 ,官方网址http://www.net112.net //play("#play",2000,1,1,1,3,width,height, speed1,showp); //top_ad(strng, startdate, stoptime, date1, date2)顶部广告 //auto(tmp)//自适应触发 //float(obj, itop) //两侧对联广告 //$("#cms1 .content embed[src$='.flv']").each(function(){ //var auto=0; //if($(this).attr("autostart")=="false"){auto=1} //flv($(this),$(this).attr("src"),"",$(this).attr("width"),$(this).attr("height"),auto); //}) function play(obj1, speed, ShowType, ShowText, ShowMun, direction, pw, ph, speed1, showp,auto_height) { var n = 0; var t = 0; var obj = obj1; var m = 0; var p = direction; var ipw = 0; var cint = function(mun) { mun = parseInt(mun); if (isNaN(mun)) { return 0; } else { return mun; } }; var getpw = function(obj) { return cint($(obj).css("width")) + cint($(obj).css("margin-left")) + cint($(obj).css("margin-right")) + cint($(obj).css("padding-left")) + cint($(obj).css("padding-right")) + cint($(obj).css("border-right-width")) + cint($(obj).css("border-left-width")); }; showp = cint(showp); auto_height=cint(auto_height); pw = cint(pw); ph = cint(ph); var l = ph / pw; var auto=function auto(obj) {$(window).resize(function() {return config(obj);});return config(obj);} var config= function(obj) { //按设置尺寸比例根据父节点宽度自适应 pw = $(obj).parent().width() - ipw; if(auto_height==0){ ph = pw * l;} $(obj).width(pw); $(obj).height(ph); $(obj + " .play_list").children().width(pw); $(obj + " .play_list").children().height(ph); $(obj + " .play_bg").height(ph); $(obj + " .play_bg").width(pw); $(obj + " .play_text").width(pw); $(obj + " .left_btn").height(ph); $(obj + " .right_btn").height(ph); $(obj + " .left_btn").css({ "line-height":ph + "px", left:"-" + $(obj + " .left_btn").width() + "px" }); $(obj + " .right_btn").css({ "line-height":ph + "px", right:"-" + $(obj + " .right_btn").width() + "px" }); }; var move = function(p) { if (p == 4) { var t = $(obj + " .play_list").children().height(); var l = 0; } else if (direction == 3) { var t = "-" + $(obj + " .play_list").children().height(); var l = 0; } else if (direction == 2) { var t = 0; var l = $(obj + " .play_list").children().width(); } else { var t = 0; var l = "-" + $(obj + " .play_list").children().width(); } $(obj + " .play_list").children().eq(m).css({ top:0, left:0 }).siblings().css({ left:l + "px", top:t + "px" }); $(obj + " .play_list").children().eq(m).stop(true, false).animate({ top:-t, left:-l }, speed1).siblings().stop(true, false).animate({ top:0, left:0 }, speed1); }; if ($(obj + " .play_bg").length > 0) { //防止重复增加节点 auto(obj); } else { if (speed1 == null) { speed1 = 500; } ipw = getpw(obj); var count = $(obj + " .play_list").children().size(); $(obj).append("
"); if (showp == 1) { $(obj).append("
<
"); $(obj).append("
>
"); } else { $(obj).append("
"); $(obj).append("
"); } $(obj).append("
"); var btn = "
"; for (var i = 1; i <= count; i++) { if (ShowMun == 2) { btn = btn + "
  • "; } else if (ShowMun == 1) { btn = btn + "
  • " + i + "
  • "; } else { btn = btn + "
  • "; } } btn = btn + "
    "; $(obj + " .play_text").append(btn); $(obj + " .play_text").width(pw - getpw(obj + " .play_text")); if (ShowText == 1) { $(obj + " .play_text").append("
    " + strng + "
    "); if (date1 == null) { date1 = 500; } if (startdate == null) { startdate = 0; } if (date2 == null) { date2 = date1; } if (stoptime == null) { stoptime = 5e3; } $("#top_ad").hide(); setTimeout(function() { $("#top_ad").show(date1); }, startdate); setTimeout(function() { $("#top_ad").hide(date2); }, 5e3); } function float(obj, itop) { if (itop == null) { itop = 0; } $(obj).css({ top:itop + "px" }); $(this).scroll(function() { var bodyTop = 0; $(obj).css({ position:"absolute" }); if (typeof window.pageYOffset != "undefined") { bodyTop = window.pageYOffset; } else if (typeof document.compatMode != "undefined" && document.compatMode != "BackCompat") { bodyTop = document.documentElement.scrollTop; } else if (typeof document.body != "undefined") { bodyTop = document.body.scrollTop; } $(obj).css("top", itop + bodyTop); }); } function flv(obj, files, texts, swf_width, swf_height, auto) { var strng = ""; if (obj.attr("src").indexOf(".flv") >= 0) { var config = "" + auto + ":自动播放|2:连续播放|100:默认音量|0:控制栏位置|2:控制栏显示|0x000033:主体颜色|60:主体透明度|0x66ff00:光晕颜色|0xffffff:图标颜色|0xffffff:文字颜色|:logo文字|:logo地址|:结束swf地址"; strng = ''; strng = strng + ''; strng = strng + ''; strng = strng + ''; strng = strng + ''; strng = strng + ""; } if (strng != "") { obj.after(strng); obj.remove(); } } function playpro(obj, mun,obj1, obj2, p, speed, speed1) {//产品滚动 //p,left,right,top,bottom if (typeof speed1 == "undefined") { var speed1 = 300; } if (typeof speed == "undefined") { var speed = 3e3; } if (typeof p == "undefined") { var p = "left"; } var str = $(obj).html(); var pw = $(obj).width() / mun; var count = mun; $(obj).children().css({float:"left",position:"absolute",left:0,top: 0}); $(obj).css({width:$(obj).parent().width(),float:'left',overflow: 'hidden',position: 'relative',height:$(obj).children().children().height()}); if ($(obj).children().children().length < count) { count = $(obj).children().children().length * count; } $(obj).children().children().width(pw); var str = ""; for (var i = 0; i < count; i++) { str += $(obj).children().html(); } var n = 0; $(obj).children().html(str); $(obj).children().width($(obj).children().children().width() * $(obj).children().children().length); if (p == "right") { $(obj).children().css("left", "-" + ($(obj).children().width() - $(obj).width()) + "px"); } if (p == "bottom") { $(obj).children().css("top", "-" + ($(obj).children().height() - $(obj).height()) + "px"); } t = setInterval(function() { switch (p) { case "right": case "bottom": $(obj2).trigger("click"); break; default: $(obj1).trigger("click"); } }, speed); var pp = "left"; if (p == "top" || p == "bottom") { $(obj1).click(function() { n = n - 1; if (n + mun < 1) { n = 0; } $(obj).children().animate({ top:$(obj).children().parent().height() * n + "px" }, speed1); }); $(obj2).click(function() { n = n + 1; if (n > 0) { n =-m; } $(obj).children().animate({ top:$(obj).children().parent().height() * n + "px" }, speed1); }); } else { $(obj1).click(function() { n = n - 1; if (n + mun < 1) { n = 0; } $(obj).children().animate({ left:$(obj).children().parent().width() * n + "px" }, speed1); }); $(obj2).click(function() { n = n + 1; if (n > 0) { n =-m; } $(obj).children().animate({ left:$(obj).children().parent().width() * n + "px" }, speed1); }); } }