var NSSN_CONFIG = []; NSSN_CONFIG['login_status'] ='0'; NSSN_CONFIG['nssn_ip'] = '155.159.254.40'; NSSN_CONFIG['nssn_url'] = 'http://www.gzjulin8.com'; NSSN_CONFIG['nssn_dir'] = '/'; NSSN_CONFIG['mysite'] = 'gzjulin.com'; NSSN_CONFIG['html'] = '0'; NSSN_CONFIG['language'] = '0'; NSSN_CONFIG['line'] = '_'; NSSN_CONFIG['title'] = '广州巨林机械制造有限公司'; NSSN_CONFIG['line'] = '_'; NSSN_CONFIG['add_title'] = '广州巨林机械制造有限公司'; NSSN_CONFIG['keywords'] = '广州巨林机械制造有限公司'; NSSN_CONFIG['des'] = '广州巨林机械制造有限公司专业制造包装机械、食品机械、灌装机械、喷码设备等五大系列70多个品种产品'; NSSN_CONFIG['url'] = 'http://www.gzjulin8.com'; NSSN_CONFIG['company'] = '广州巨林机械制造有限公司'; NSSN_CONFIG['dingwei'] = '广州巨林机械制造有限公司'; NSSN_CONFIG['copy_right'] = '版权所有 ® 2006-2020 All Rights Reserved 广州巨林机械制造有限公司'; NSSN_CONFIG['mobile_url'] = ''; NSSN_CONFIG['flv_bg'] = 'libs/ico/flv.gif'; NSSN_CONFIG['smtp_server'] = 'smtp.qq.com'; NSSN_CONFIG['smtp_mail'] = 'newsong@qq.com'; NSSN_CONFIG['welcome'] = '

客服<\/b>:现在<\/p>

请问有什么可以帮到您的?<\/p><\/div>'; NSSN_CONFIG['is_qq_text'] = '\"点击这里给我发消息\"<\/a>客服1
\r\n\r\n\r\n\r\n
\"点击这里给我发消息\"<\/a>客服2
\r\n\r\n\r\n\r\n
\"点击这里给我发消息\"<\/a>客服3
\r\n\r\n\r\n
\"点击这里给我发消息\"<\/a>客服4
\r\n\r\n\r\n
\"点击这里给我发消息\"<\/a>客服5
'; NSSN_CONFIG['mail'] = 'newsong@qq.com'; NSSN_CONFIG['mail2'] = '59015622@qq.com'; NSSN_CONFIG['tel'] = '020-36482365 36482337 36482335 '; NSSN_CONFIG['tel2'] = ''; NSSN_CONFIG['fax'] = ''; NSSN_CONFIG['fax2'] = ''; NSSN_CONFIG['mobile'] = '15800006529'; NSSN_CONFIG['mobile2'] = '13610279672'; NSSN_CONFIG['men'] = ''; NSSN_CONFIG['men2'] = ''; NSSN_CONFIG['address'] = '广州市白云区太和镇南岭工业区八横路5号'; NSSN_CONFIG['address2'] = '广州市白云区太和镇南岭工业区八横路5号'; NSSN_CONFIG['qq'] = '59015622'; // JavaScript Document $(function(){ $('body').click(function(){ set_cookie('nssn_top',$(document).scrollTop(),'h1'); set_cookie('nssn_seat',$(document).scrollTop(),'h1'); }) //记录点击链接 $('a').click(function(){ var nssn_a_nssn = $(this).attr('nssn'); if( nssn_a_nssn == '1'){ var nssn_a_title = $(this).attr('title'); if(!nssn_a_title) var nssn_a_title = $(this).html(); var nssn_a_href = $(this).attr('href'); $.post(NSSN_PATH+"class/send_data.php?action=record",{title:nssn_a_title,url:nssn_a_href}) } }) $(window).scroll(function(){ set_cookie('nssn_top',$(document).scrollTop(),'h1'); if ($(window).scrollTop()>NSSN_IE_HEIGHT/2){ $(".nssn_backup").fadeIn(500);}else{ $(".nssn_backup").fadeOut(500); } }) //点击鼠标右健开始显示 $(document).mousedown(function(event){ var btnNum = event.button; $(".PCshareBox").slideUp(); setTimeout(function () {$("#nssn_select_body").hide();}, 200); }) }) var NSSN_TOP = get_cookie('nssn_top'); var NSSN_PAGE_TITLE = document.title; //获取用户点击量 set_cookie("nssn_click",Number(get_cookie('nssn_click'))+1,'d1'); var NSSN_CLICK = get_cookie('nssn_click'); //实时更新停留时间 setInterval(function(){ set_cookie("nssn_time",Number(get_cookie('nssn_time'))+1,'d1'); var NSSN_TIME = Number(get_cookie('nssn_time'))+1;},1000) function new_target(url){ var w=window.open(); setTimeout(function(){ w.location=url; }, 1); return false; } //加载搜索产品 get_product('n','#postion','#replace',24); n代表新 b代表精选 也可以使用中文进行搜索 function get_product(id,div,content,limit){ $(content).css("display","none"); var content = $(content).html(); $.post(NSSN_PATH+"class/js_search.php?action=product",{str:content,id:id,limit:limit,referrer:document.referrer}, function(data){ if(data){ $(div).empty(); $(div).append(data); }else{ $(div).remove(); } }) } function get_news(id,div,content,limit){ $(content).css("display","none"); var content = $(content).html(); $.post(NSSN_PATH+"class/js_search.php?action=news",{str:content,id:id,limit:limit,referrer:document.referrer}, function(data){ if(data){ $(div).empty(); $(div).append(data); }else{ $(div).remove(); } }) } //响应式加载 nssn_get_data('inc_get_product.php?p=1&classid=19&num=6','#postion','#replace'); function nssn_get_data(url,todiv,str){ $(str).css("display","none"); var html = $(str).html(); $(todiv).append('

'); $.ajax({ type : "POST", url : NSSN_PATH+"class/"+url, data : "data="+html, success : function(data){ if(data){ $(todiv).empty(); $(todiv).append(data); } } }); } //下拉二级菜单 function nssn_pc_menu(id,id2){ $('#'+id).addClass("nssn_open_menu").slideDown(); $('#'+id2).parent().mouseleave(function(){$('#'+id).addClass("nssn_close_menu").slideUp(); }); } //下拉二级菜 function nssn_m_menu(id,id2){ if($('#'+id).css("display")=='none'){ $('#'+id).addClass("nssn_open_menu").slideDown(); }else{ $('#'+id).addClass("nssn_close_menu").slideUp(); } $('#'+id2).parent().mouseleave(function(){ $('#'+id).addClass("nssn_close_menu").slideUp(); }); } //下拉二级菜 function nssn_open(id){ if($(id).css("display")=='none'){ $(id).addClass("nssn_open").slideDown(); $('html,body,div,p').bind("mousedown",function(){ $(id).slideUp();}); $(id).parent().bind("mouseleave",function(){ $(id).slideUp();}); }else{ $(id).addClass("nssn_close").slideUp(); } } //下拉新闻菜单 function nssn_pc_news(id,id2){ $('#'+id).addClass("nssn_open_news").show(300); $('#'+id2).parent().mouseleave(function(){ $('#'+id).addClass("nssn_close_news").hide(300); }); } //下拉新闻菜单 function nssn_m_news(id,id2){ $('#'+id2).parent().css("position","relative"); if($('#'+id).css("display")=='none'){ $('#'+id).addClass("nssn_open_news").show(300); }else{ $('#'+id).addClass("nssn_close_news").hide(300);} $('#'+id2).parent().mouseleave(function(){ $('#'+id).addClass("nssn_close_news").hide(300); }); } //设置链接焦点 function nssn_focus(obj2,str,flag,flag2){ if(NSSN_CONFIG['html'] != 1){ nssn_focusa(obj2,str,flag); return ; } if(typeof str=="undefined" || str=='') var str = 'on'; var obj = $(obj2); for (var i = 0; i < obj.length; i++) { a = NSSN_URL.replace(NSSN_CONFIG['nssn_url'], '') if (a == $(obj[i]).attr("href")) { $(obj[i]).parent().addClass(str); $(obj[i]).parent().hide(); $(obj[i]).parent().fadeIn(300); if(typeof flag2!="undefined"){ var id = $(obj[i]).parent().attr("openid"); $('#li_none_'+id).css("display","block") } return; } } if(typeof flag=="undefined") $(obj[0]).parent().addClass(str); } function nssn_focusa(obj2,str,flag){ if(typeof str=="undefined" || str=='') var str = 'on'; var obj = $(obj2); for (var i = 0; i < obj.length; i++) { a = NSSN_URL.replace(NSSN_CONFIG['nssn_url'], ''); if (a == $(obj[i]).attr("href")) { $(obj[i]).parent().addClass(str); $(obj[i]).parent().hide(); $(obj[i]).parent().fadeIn(300); return;} } if(typeof flag=="undefined") $(obj[0]).addClass(str); } /*js全屏窗口*/ function nssn_window(url){var w=window.open();setTimeout(function(){w.location=url;},1);return false;} //播放声音 function play_sound(url){ $("#my_sounds").remove(); var file_ex=url.substring(url.lastIndexOf('.')).toLowerCase(); var i =Math.round(Math.random()*100000000000000000);if(file_ex == '.swf'){ $("body").append('
'); }else{ $("body").append('
no plays
'); }} //判断ip function check_ip(ip){ var re=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; if(re.test(ip)) { if( RegExp.$1<256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256) return true; } return false; } function ajax_check_name(str,id,x,d){ $.post(NSSN_PATH+"class/ajax.php?action=name",{value:str,xx:x,dd:d},function(data) { if(data==1){ show_ok(str,id); }else{ show_no(str,id) }})} function ajax_check_mail(str,id){$.post(NSSN_PATH+"class/ajax.php?action=mail",{value:str},function(data) {if(data==1){ show_ok(str,id); }else{ show_no(str,id)}})} function show_ok(str,id){$('#'+id).css('background','#FF9'); return 1; } function show_no(str,id){ $('#'+id).css('background','#F33'); return 0;} function is_mail(mail){return(new RegExp(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/).test(mail));} function is_mob(str){var reg=/^(?:13\d|15[89])-?\d{5}(\d{3}|\*{3})$/;return reg.test(str);} function is_qq(str){var reg=/^\d{5,10}$/;return reg.test(str);} function show_share(){if($(".PCshareBox").css("display")=="none"){$(".PCshareBox").slideDown();}else{$(".PCshareBox").slideUp();}} function select_body(){if(document.selection){return document.selection.createRange().text;}else{return window.getSelection().toString();}} function update_cart(obb,id,buy_num){if(obb>0){ if(obb < buy_num){ alert('起定量:'+buy_num); }else{NSSN_CART.action="?id="+id+'&num='+obb+'&action=update';NSSN_CART.submit(); }}}; function send_content(){ //alert(arguments[i]); title1 = ''; title2 = ''; str = ''; mobile = '' qq = ''; mail = ''; len = arguments.length; if(len == 2){ //如果不能获取第二位的值,就把他当作标题 action = arguments[0]; lr = arguments[1].substring(0,1); if(lr == "#" || lr == "."){ contentt = $(arguments[1]).val(); }else{ title1 = arguments[1]; contentt =''; } }else if(len==3){ action = arguments[0]; lr = arguments[1].substring(0,1); if(lr == "#" || lr == "."){ contentt = $(arguments[1]).val(); title1 = arguments[2]; }else{ title1 = arguments[1]; title2 = arguments[2]; contentt =''; } }else if(len==1){ action = arguments[0]; contentt =''; }else{ action = ''; contentt = ''; } if(typeof contentt=="undefined" || contentt=="" || contentt==false || contentt==null){ if(action == 'mobile'){ title = '请输入您的手机号码'; }else if(action == 'qq'){ title = '请输入您的QQ号码'; }else if(action == 'mail'){ title = '请输入您的邮箱地址'; }else if(action == 'track'){ title = '请输入12位的数字'; }else{ title = '请您输入'; } if(title1) title = title1; contentt = prompt(title,""); if(!contentt) return ; } if(action == 'mobile'){ //如果限制手机 if(!is_mob(contentt)){ alert('【'+contentt+'】是错误的手机'); return ; } mobile = contentt; }else if(action == 'mail'){ if(!is_mail(contentt)){ alert('【'+contentt+'】是错误的邮箱'); return ; } mail = contentt; }else if(action == 'qq'){ if(!is_qq(contentt)){ alert('【'+contentt+'】是错误的QQ'); return ; } tel = contentt;contentt='' }else if(action == 'track'){ nssn_window(NSSN_PATH+'track.php?keywords='+contentt); return ; } url = NSSN_PATH+"class/send.php?&mode=ajax&action=book"; str = contentt+'
留言网址:'+NSSN_URL; $.post(url,{title:title2+'【快速留言】',content:str,mobile:mobile,mail:mail,qq:qq},function(data) { if(data){ alert(data); }else{ alert('发送失败,请重试'); } }); } function show_talk(obj,type,productid){ var classid = data_arr[type]; $(function(){ $(obj).load(NSSN_PATH+"class/js_libs.php?action=talk",{cid:classid,uid:productid}); }) } //加载模块 function show_jquery(obj,url){ $(function(){ $(obj).load(NSSN_PATH+"libs/js/"+url);})} //flash展示 function flash(url, width, height){ document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); } //搜索 function product_search(id){ window.location.href = NSSN_PATH+"search.php?action=search&keywords="+document.getElementById(id).value} //加载友好体验 //$('').prependTo("head"); //动画函数 //模块内容从左边出来 function get_top(str){ return $(str).offset().top;} function goto(str,time){ var re = /^[0-9]+.?[0-9]*$/; if(re.test(str)){ $('body,html').animate({scrollTop:str},time); }else if(str.substr(0,1)=='+'){ var top = $(document).scrollTop()+str; $('body,html').animate({scrollTop:top},time); }else{ if(typeof time=="undefined") time = 1000; if($(str).length > 0){ $('body,html').animate({scrollTop:get_top(str)},time); }else{ alert('加载中请 稍等...'); } } } //指定id上显示加载文件内容 function load_file(seat,php){ $(seat).load(php);} //指定id上显示加载文件内容 function load_field(seat,id,type){ if(typeof type=="undefined"){ $(seat).load(NSSN_PATH+"class/js_libs.php?action=field",{uid:id});}else{ $(seat).load(NSSN_PATH+"class/js_libs.php?action=field",{uid:id,cid:type});} } function load_photo(seat,id){ if(typeof id=="undefined"){ $(seat).load(NSSN_PATH+"class/js_libs.php?action=photo",{uid:NSSN_ID});}else{ $(seat).load(NSSN_PATH+"class/js_libs.php?action=photo",{uid:id}); }} //模块动画 function jquery_move(obj){ var timer = 0; //$(obj).css("margin-left","-20px"); $(window).bind("scroll",function(event) { $(obj).each(function() { var fold = $(window).height() + $(window).scrollTop(); if (fold >= $(this).offset().top) { $(this).trigger("appear"); } }); }); $(obj).each(function() { if ($(window).height() > $(this).offset().top) { $(this).css("margin-left","-50px"); timer = timer + 150; $(this).animate({ marginLeft: "0px" }, timer); }else{ $(this).one("appear",function(){ $(this).css("margin-left","-50px"); timer = timer + 150; $(this).animate({ marginLeft: "0px" }, timer); }); } }); } function hide_id(div,time){ setTimeout(function(){ $(div).css("display","none")},time)} //循环滚动函数 function Marquee() {this.ID=document.getElementById(arguments[0]);if(!this.ID) {alert("您要设置的\""+arguments[0]+"\"初始化错误\r\n请检查标签ID设置是否正确!");this.ID=-1;return;} this.Direction=this.Width=this.Height=this.DelayTime=this.WaitTime=this.CTL=this.StartID=this.Stop=this.MouseOver=0;this.Step=1;this.Timer=30;this.DirectionArray={"top":0,"up":0,"bottom":1,"down":1,"left":2,"right":3};if(typeof arguments[1]=="number"||typeof arguments[1]=="string")this.Direction=arguments[1];if(typeof arguments[2]=="number")this.Step=arguments[2];if(typeof arguments[3]=="number")this.Width=arguments[3];if(typeof arguments[4]=="number")this.Height=arguments[4];if(typeof arguments[5]=="number")this.Timer=arguments[5];if(typeof arguments[6]=="number")this.DelayTime=arguments[6];if(typeof arguments[7]=="number")this.WaitTime=arguments[7];if(typeof arguments[8]=="number")this.ScrollStep=arguments[8];this.ID.style.overflow=this.ID.style.overflowX=this.ID.style.overflowY="hidden";this.ID.noWrap=true;this.IsNotOpera=(navigator.userAgent.toLowerCase().indexOf("opera")==-1);if(arguments.length>=7)this.Start();} Marquee.prototype.Start=function() {if(this.ID==-1)return;if(this.WaitTime<800)this.WaitTime=800;if(this.Timer<20)this.Timer=20;if(this.Width==0)this.Width=parseInt(this.ID.style.width);if(this.Height==0)this.Height=parseInt(this.ID.style.height);if(typeof this.Direction=="string")this.Direction=this.DirectionArray[this.Direction.toString().toLowerCase()];this.HalfWidth=Math.round(this.Width/2);this.HalfHeight=Math.round(this.Height/2);this.BakStep=this.Step;this.ID.style.width=this.Width+"px";this.ID.style.height=this.Height+"px";if(typeof this.ScrollStep!="number")this.ScrollStep=this.Direction>1?this.Width:this.Height;var templateLeft="
MSCLASS_TEMP_HTMLMSCLASS_TEMP_HTML
";var templateTop="
MSCLASS_TEMP_HTML
MSCLASS_TEMP_HTML
";var msobj=this;msobj.tempHTML=msobj.ID.innerHTML;if(msobj.Direction<=1) {msobj.ID.innerHTML=templateTop.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);} else {if(msobj.ScrollStep==0&&msobj.DelayTime==0) {msobj.ID.innerHTML+=msobj.ID.innerHTML;} else {msobj.ID.innerHTML=templateLeft.replace(/MSCLASS_TEMP_HTML/g,msobj.ID.innerHTML);}} var timer=this.Timer;var delaytime=this.DelayTime;var waittime=this.WaitTime;msobj.StartID=function(){msobj.Scroll()} msobj.Continue=function() {if(msobj.MouseOver==1) {setTimeout(msobj.Continue,delaytime);} else {clearInterval(msobj.TimerID);msobj.CTL=msobj.Stop=0;msobj.TimerID=setInterval(msobj.StartID,timer);}} msobj.Pause=function() {msobj.Stop=1;clearInterval(msobj.TimerID);setTimeout(msobj.Continue,delaytime);} msobj.Begin=function() {msobj.ClientScroll=msobj.Direction>1?msobj.ID.scrollWidth/2:msobj.ID.scrollHeight/2;if((msobj.Direction<=1&&msobj.ClientScroll<=msobj.Height+msobj.Step)||(msobj.Direction>1&&msobj.ClientScroll<=msobj.Width+msobj.Step)){msobj.ID.innerHTML=msobj.tempHTML;delete(msobj.tempHTML);return;} delete(msobj.tempHTML);msobj.TimerID=setInterval(msobj.StartID,timer);if(msobj.ScrollStep<0)return;msobj.ID.onmousemove=function(event) {if(msobj.ScrollStep==0&&msobj.Direction>1) {var event=event||window.event;if(window.event) {if(msobj.IsNotOpera) {msobj.EventLeft=event.srcElement.id==msobj.ID.id?event.offsetX-msobj.ID.scrollLeft:event.srcElement.offsetLeft-msobj.ID.scrollLeft+event.offsetX;} else {msobj.ScrollStep=null;return;}} else {msobj.EventLeft=event.layerX-msobj.ID.scrollLeft;} msobj.Direction=msobj.EventLeft>msobj.HalfWidth?3:2;msobj.AbsCenter=Math.abs(msobj.HalfWidth-msobj.EventLeft);msobj.Step=Math.round(msobj.AbsCenter*(msobj.BakStep*2)/msobj.HalfWidth);}} msobj.ID.onmouseover=function() {if(msobj.ScrollStep==0)return;msobj.MouseOver=1;clearInterval(msobj.TimerID);} msobj.ID.onmouseout=function() {if(msobj.ScrollStep==0) {if(msobj.Step==0)msobj.Step=1;return;} msobj.MouseOver=0;if(msobj.Stop==0) {clearInterval(msobj.TimerID);msobj.TimerID=setInterval(msobj.StartID,timer);}}} setTimeout(msobj.Begin,waittime);} Marquee.prototype.Scroll=function() {switch(this.Direction) {case 0:this.CTL+=this.Step;if(this.CTL>=this.ScrollStep&&this.DelayTime>0) {this.ID.scrollTop+=this.ScrollStep+this.Step-this.CTL;this.Pause();return;} else {if(this.ID.scrollTop>=this.ClientScroll) {this.ID.scrollTop-=this.ClientScroll;} this.ID.scrollTop+=this.Step;} break;case 1:this.CTL+=this.Step;if(this.CTL>=this.ScrollStep&&this.DelayTime>0) {this.ID.scrollTop-=this.ScrollStep+this.Step-this.CTL;this.Pause();return;} else {if(this.ID.scrollTop<=0) {this.ID.scrollTop+=this.ClientScroll;} this.ID.scrollTop-=this.Step;} break;case 2:this.CTL+=this.Step;if(this.CTL>=this.ScrollStep&&this.DelayTime>0) {this.ID.scrollLeft+=this.ScrollStep+this.Step-this.CTL;this.Pause();return;} else {if(this.ID.scrollLeft>=this.ClientScroll) {this.ID.scrollLeft-=this.ClientScroll;} this.ID.scrollLeft+=this.Step;} break;case 3:this.CTL+=this.Step;if(this.CTL>=this.ScrollStep&&this.DelayTime>0) {this.ID.scrollLeft-=this.ScrollStep+this.Step-this.CTL;this.Pause();return;} else {if(this.ID.scrollLeft<=0) {this.ID.scrollLeft+=this.ClientScroll;} this.ID.scrollLeft-=this.Step;} break;}} var sina={$:function(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}},isIE:navigator.appVersion.indexOf("MSIE")!=-1?true:false,addEvent:function(l,i,I){if(l.attachEvent){l.attachEvent("on"+i,I)}else{l.addEventListener(i,I,false)}},delEvent:function(l,i,I){if(l.detachEvent){l.detachEvent("on"+i,I)}else{l.removeEventListener(i,I,false)}},readCookie:function(O){var o="",l=O+"=";if(document.cookie.length>0){var i=document.cookie.indexOf(l);if(i!=-1){i+=l.length;var I=document.cookie.indexOf(";",i);if(I==-1)I=document.cookie.length;o=unescape(document.cookie.substring(i,I))}};return o},writeCookie:function(i,l,o,c){var O="",I="";if(o!=null){O=new Date((new Date).getTime()+o*3600000);O="; expires="+O.toGMTString()};if(c!=null){I=";domain="+c};document.cookie=i+"="+escape(l)+O+I},readStyle:function(I,l){if(I.style[l]){return I.style[l]}else if(I.currentStyle){return I.currentStyle[l]}else if(document.defaultView&&document.defaultView.getComputedStyle){var i=document.defaultView.getComputedStyle(I,null);return i.getPropertyValue(l)}else{return null}}}; //滚动图片构造函数 //UI&UE Dept. mengjia //080623 //滚动图片构造函数 function ScrollPic(scrollContId,arrLeftId,arrRightId,dotListId,listType){ this.scrollContId = scrollContId; //内容容器ID this.arrLeftId = arrLeftId; //左箭头ID this.arrRightId = arrRightId; //右箭头ID this.dotListId = dotListId; //点列表ID this.listType = listType; //列表类型 this.dotClassName = "dotItem";//点className this.dotOnClassName = "dotItemOn";//当前点className this.dotObjArr = []; this.listEvent = "onclick"; this.circularly = true; //循环滚动(无缝循环) this.pageWidth = 0; //翻页宽度 this.frameWidth = 0; //显示框宽度 this.speed = 10; //移动速度(单位毫秒,越小越快) this.space = 10; //每次移动像素(单位px,越大越快) this.scrollWidth = 5; //横向滚动宽度 this.upright = false; //垂直的滚动 this.pageIndex = 0; this.autoPlay = true; this.autoPlayTime = 2; //秒 this._autoTimeObj; this._scrollTimeObj; this._state = "ready"; // ready | floating | stoping this.stripDiv = document.createElement("DIV"); this.lDiv01 = document.createElement("DIV"); this.lDiv02 = document.createElement("DIV"); }; ScrollPic.prototype = { version : "1.41", author : "mengjia", pageLength : 0, touch : true, initialize : function(){ //初始化 var thisTemp = this; if(!this.scrollContId){ throw new Error("必须指定scrollContId."); return; }; this.scDiv = this.$(this.scrollContId); if(!this.scDiv){ throw new Error("scrollContId不是正确的对象.(scrollContId = \""+ this.scrollContId +"\")"); return; }; this.scDiv.style[this.upright?'height':'width'] = this.frameWidth + "px"; this.scDiv.style.overflow = "hidden"; //HTML this.lDiv01.innerHTML = this.scDiv.innerHTML; this.scDiv.innerHTML = ""; this.scDiv.appendChild(this.stripDiv); this.stripDiv.appendChild(this.lDiv01); if(this.circularly){//无缝循环 this.stripDiv.appendChild(this.lDiv02); this.lDiv02.innerHTML = this.lDiv01.innerHTML }; this.stripDiv.style.overflow = "hidden"; this.stripDiv.style.zoom = "1"; this.stripDiv.style[this.upright?'height':'width'] = "32766px"; if(!this.upright){ this.lDiv01.style.cssFloat = "left"; this.lDiv01.style.styleFloat = "left"; this.lDiv01.style.overflow = "hidden"; }; this.lDiv01.style.zoom = "1"; if(this.circularly && !this.upright){ //无缝循环设置CSS this.lDiv02.style.cssFloat = "left"; this.lDiv02.style.styleFloat = "left"; this.lDiv02.style.overflow = "hidden"; }; this.lDiv02.style.zoom = "1"; this.addEvent(this.scDiv,"mouseover",function(){thisTemp.stop()}); this.addEvent(this.scDiv,"mouseout",function(){thisTemp.play()}); //Arrowhead event //left if(this.arrLeftId){ this.alObj = this.$(this.arrLeftId); if(this.alObj){ this.addEvent(this.alObj,"mousedown",function(){thisTemp.rightMouseDown()}); this.addEvent(this.alObj,"mouseup",function(){thisTemp.rightEnd()}); this.addEvent(this.alObj,"mouseout",function(){thisTemp.rightEnd()}); }; }; //right if(this.arrRightId){ this.arObj = this.$(this.arrRightId); if(this.arObj){ this.addEvent(this.arObj,"mousedown",function(){thisTemp.leftMouseDown()}); this.addEvent(this.arObj,"mouseup",function(){thisTemp.leftEnd()}); this.addEvent(this.arObj,"mouseout",function(){thisTemp.leftEnd()}); }; }; var pages = Math.ceil(this.lDiv01[this.upright?'offsetHeight':'offsetWidth'] / this.frameWidth),i,tempObj; this.pageLength = pages; //dot if(this.dotListId){ this.dotListObj = this.$(this.dotListId); this.dotListObj.innerHTML = ""; if(this.dotListObj){ for(i=0;i= this.lDiv01[this._sWidth]){ this.scDiv[this._scroll] = this.scDiv[this._scroll] + this.space - this.lDiv01[this._sWidth]; }else{ this.scDiv[this._scroll] += this.space; }; }else{ if(this.scDiv[this._scroll] + this.space >= this.lDiv01[this._sWidth] - this.frameWidth){ this.scDiv[this._scroll] = this.lDiv01[this._sWidth] - this.frameWidth; //停 this.leftEnd(); }else{ this.scDiv[this._scroll] += this.space; }; }; this.accountPageIndex(); }, moveRight : function(){ if(this.circularly){ //无缝循环 if(this.scDiv[this._scroll] - this.space <= 0){ this.scDiv[this._scroll] = this.lDiv01[this._sWidth] + this.scDiv[this._scroll] - this.space; }else{ this.scDiv[this._scroll] -= this.space; }; }else{ if(this.scDiv[this._scroll] - this.space <= 0){ this.scDiv[this._scroll] = 0; //停 this.rightEnd(); }else{ this.scDiv[this._scroll] -= this.space; }; }; this.accountPageIndex(); }, leftEnd : function(){ if(this._state != "floating" && this._state != 'touch'){return}; this._state = "stoping"; clearInterval(this._scrollTimeObj); var fill = this.pageWidth - this.scDiv[this._scroll] % this.pageWidth; this.move(fill); }, rightEnd : function(){ if(this._state != "floating" && this._state != 'touch'){return}; this._state = "stoping"; clearInterval(this._scrollTimeObj); var fill = - this.scDiv[this._scroll] % this.pageWidth; this.move(fill); }, move : function(num,quick){ var thisTemp = this; var thisMove = num/5; var theEnd = false; if(!quick){ if(thisMove > this.space){thisMove = this.space}; if(thisMove < -this.space){thisMove = -this.space}; }; if(Math.abs(thisMove)<1 && thisMove!=0){ thisMove = thisMove>=0?1:-1; }else{ thisMove = Math.round(thisMove); }; var temp = this.scDiv[this._scroll] + thisMove; if(thisMove>0){ if(this.circularly){ //无缝循环 if(this.scDiv[this._scroll] + thisMove >= this.lDiv01[this._sWidth]){ this.scDiv[this._scroll] = this.scDiv[this._scroll] + thisMove - this.lDiv01[this._sWidth]; }else{ this.scDiv[this._scroll] += thisMove; }; }else{ if(this.scDiv[this._scroll] + thisMove >= this.lDiv01[this._sWidth] - this.frameWidth){ this.scDiv[this._scroll] = this.lDiv01[this._sWidth] - this.frameWidth; this._state = "ready"; theEnd = true; //return; }else{ this.scDiv[this._scroll] += thisMove; }; }; }else{ if(this.circularly){ //无缝循环 if(this.scDiv[this._scroll] + thisMove < 0){ this.scDiv[this._scroll] = this.lDiv01[this._sWidth] + this.scDiv[this._scroll] + thisMove; }else{ this.scDiv[this._scroll] += thisMove; }; }else{ if(this.scDiv[this._scroll] - thisMove < 0){ this.scDiv[this._scroll] = 0; this._state = "ready"; theEnd = true; //return; }else{ this.scDiv[this._scroll] += thisMove; }; }; }; if(typeof(this.onpagechange) === 'function'){ this.onpagechange(); }; if(theEnd){ return; }; num -= thisMove; if(Math.abs(num) == 0){ this._state = "ready"; if(this.autoPlay){this.play()}; this.accountPageIndex(); return; }else{ this.accountPageIndex(); this._scrollTimeObj = setTimeout(function(){thisTemp.move(num,quick)},this.speed) }; }, pre : function(){ if(this._state != "ready"){return}; this._state = "stoping"; this.pageTo(this.pageIndex - 1); }, next : function(reStar){ if(this._state != "ready"){return}; this._state = "stoping"; if(this.circularly){ this.pageTo(this.pageIndex + 1); }else{ if(this.scDiv[this._scroll] >= this.lDiv01[this._sWidth] - this.frameWidth){ this._state = "ready"; if(reStar){this.pageTo(0)}; }else{ this.pageTo(this.pageIndex + 1); }; }; }, play : function(){ var thisTemp = this; if(!this.autoPlay){return}; clearInterval(this._autoTimeObj); this._autoTimeObj = setInterval(function(){thisTemp.next(true)},this.autoPlayTime * 1000); }, stop : function(){ clearInterval(this._autoTimeObj); }, pageTo : function(num){ if(this.pageIndex == num){return}; if(num < 0){num = this.pageLength - 1}; clearTimeout(this._scrollTimeObj); this._state = "stoping"; var fill = num * this.frameWidth - this.scDiv[this._scroll]; this.move(fill,true); }, accountPageIndex : function(){ var pageIndex = Math.floor(this.scDiv[this._scroll] / this.frameWidth); if(pageIndex == this.pageIndex){return}; this.pageIndex = pageIndex; if(this.pageIndex > Math.floor(this.lDiv01[this.upright?'offsetHeight':'offsetWidth'] / this.frameWidth )){this.pageIndex = 0}; if(typeof(this.onnowpage) === 'function'){ this.onnowpage(this.pageIndex); } var i; //alert(this.pageIndex); for(i=0;i 1){ //多点触摸 this.iPadStatus = 'ok'; return; }; this.iPadLastX = e.touches[0].pageX; var cX = this.iPadX - this.iPadLastX; if(this.iPadStatus == 'ok'){ if(this.iPadScrollY == window.pageYOffset && this.iPadScrollX == window.pageXOffset && Math.abs(cX)>this.scrollWidth){ //横向触摸 this.iPadStatus = 'touch'; }else{ return; }; }; this._state = 'touch'; var scrollNum = this.scDivScrollLeft + cX; if(scrollNum >= this.lDiv01[this._sWidth]){ scrollNum = scrollNum - this.lDiv01[this._sWidth]; }; if(scrollNum < 0){ scrollNum = scrollNum + this.lDiv01[this._sWidth]; }; this.scDiv[this._scroll] = scrollNum; e.preventDefault(); }, _touchend : function(e){ if(this.iPadStatus != 'touch'){return}; this.iPadStatus = 'ok'; //this._state = 'ready'; var cX = this.iPadX - this.iPadLastX; if(cX<0){ this.rightEnd(); }else{ this.leftEnd(); }; this.play(); }, $ : function(objName){if(document.getElementById){return eval('document.getElementById("'+objName+'")')}else{return eval('document.all.'+objName)}}, isIE : navigator.appVersion.indexOf("MSIE")!=-1?true:false, //Event addEvent : function(obj,eventType,func){if(obj.attachEvent){obj.attachEvent("on" + eventType,func);}else{obj.addEventListener(eventType,func,false)}}, delEvent : function(obj,eventType,func){ if(obj.detachEvent){obj.detachEvent("on" + eventType,func)}else{obj.removeEventListener(eventType,func,false)} }, //Cookie readCookie : function(l){var i="",I=l+"=";if(document.cookie.length>0){var offset=document.cookie.indexOf(I);if(offset!=-1){offset+=I.length;var end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;i=unescape(document.cookie.substring(offset,end))}};return i}, writeCookie : function(O,o,l,I){var i="",c="";if(l!=null){i=new Date((new Date).getTime()+l*3600000);i="; expires="+i.toGMTString()};if(I!=null){c=";domain="+I};document.cookie=O+"="+escape(o)+i+c}, //Style readStyle:function(i,I){if(i.style[I]){return i.style[I]}else if(i.currentStyle){return i.currentStyle[I]}else if(document.defaultView&&document.defaultView.getComputedStyle){var l=document.defaultView.getComputedStyle(i,null);return l.getPropertyValue(I)}else{return null}} }; function ScrollPicTop(e, t, n, r) { this.scrollContId = e, this.arrLeftId = t, this.arrRightId = n, this.dotListId = r, this.dotClassName = "dotItem", this.dotOnClassName = "dotItemOn", this.dotObjArr = [], this.pageWidth = 0, this.frameWidth = 0, this.speed = 10, this.space = 10, this.pageIndex = 0, this.autoPlay = !0, this.autoPlayTime = 5; var i, s, o = "ready"; this.stripDiv = document.createElement("DIV"), this.listDiv01 = document.createElement("DIV"), this.listDiv02 = document.createElement("DIV"), ScrollPicTop.childs || (ScrollPicTop.childs = []), this.ID = ScrollPicTop.childs.length, ScrollPicTop.childs.push(this), this.initialize = function () { if (!this.scrollContId) throw new Error("必须指定scrollContId."); this.scrollContDiv = sina.$(this.scrollContId); if (!this.scrollContDiv) throw new Error('scrollContId不是正确的对象.(scrollContId = "' + this.scrollContId + '")'); this.scrollContDiv.style.width = this.frameWidth + "px", this.scrollContDiv.style.overflow = "hidden", this.listDiv01.innerHTML = this.listDiv02.innerHTML = this.scrollContDiv.innerHTML, this.scrollContDiv.innerHTML = "", this.scrollContDiv.appendChild(this.stripDiv), this.stripDiv.appendChild(this.listDiv01), this.stripDiv.appendChild(this.listDiv02), this.stripDiv.style.overflow = "hidden", this.stripDiv.style.zoom = "1", this.stripDiv.style.height = "32766px"; var e = navigator.userAgent.toUpperCase().indexOf("MSIE") == -1 ? !1 : !0; e ? (this.listDiv01.style.styleFloat = "left", this.listDiv02.style.styleFloat = "left") : (this.listDiv01.style.cssFloat = "left", this.listDiv02.style.cssFloat = "left"), sina.addEvent(this.scrollContDiv, "mouseover", Function("ScrollPicTop.childs[" + this.ID + "].stop()")), sina.addEvent(this.scrollContDiv, "mouseout", Function("ScrollPicTop.childs[" + this.ID + "].play()")), this.arrLeftId && (this.arrLeftObj = sina.$(this.arrLeftId), this.arrLeftObj && (sina.addEvent(this.arrLeftObj, "mousedown", Function("ScrollPicTop.childs[" + this.ID + "].rightMouseDown()")), sina.addEvent(this.arrLeftObj, "mouseup", Function("ScrollPicTop.childs[" + this.ID + "].rightEnd()")), sina.addEvent(this.arrLeftObj, "mouseout", Function("ScrollPicTop.childs[" + this.ID + "].rightEnd()")))), this.arrRightId && (this.arrRightObj = sina.$(this.arrRightId), this.arrRightObj && (sina.addEvent(this.arrRightObj, "mousedown", Function("ScrollPicTop.childs[" + this.ID + "].leftMouseDown()")), sina.addEvent(this.arrRightObj, "mouseup", Function("ScrollPicTop.childs[" + this.ID + "].leftEnd()")), sina.addEvent(this.arrRightObj, "mouseout", Function("ScrollPicTop.childs[" + this.ID + "].leftEnd()")))); if (this.dotListId) { this.dotListObj = sina.$(this.dotListId); if (this.dotListObj) { var t = Math.round(this.listDiv01.offsetWidth / this.frameWidth + .4), n, r; for (n = 0; n < t; n++) r = document.createElement("span"), this.dotListObj.appendChild(r), this.dotObjArr.push(r), n == this.pageIndex ? r.className = this.dotClassName : r.className = this.dotOnClassName, r.title = "第" + (n + 1) + "页", sina.addEvent(r, "click", Function("ScrollPicTop.childs[" + this.ID + "].pageTo(" + n + ")")) } } this.autoPlay && this.play() }, this.leftMouseDown = function () { if (o != "ready") return; o = "floating", s = setInterval("ScrollPicTop.childs[" + this.ID + "].moveLeft()", this.speed) }, this.rightMouseDown = function () { if (o != "ready") return; o = "floating", s = setInterval("ScrollPicTop.childs[" + this.ID + "].moveRight()", this.speed) }, this.moveLeft = function () { this.scrollContDiv.scrollTop + this.space >= this.listDiv01.scrollWidth ? this.scrollContDiv.scrollTop = this.scrollContDiv.scrollTop + this.space - this.listDiv01.scrollHeight : this.scrollContDiv.scrollTop += this.space, this.accountPageIndex() }, this.moveRight = function () { this.scrollContDiv.scrollTop - this.space <= 0 ? this.scrollContDiv.scrollTop = this.listDiv01.scrollHeight + this.scrollContDiv.scrollTop - this.space : this.scrollContDiv.scrollTop -= this.space, this.accountPageIndex() }, this.leftEnd = function () { if (o != "floating") return; o = "stoping", clearInterval(s); var e = this.pageWidth - this.scrollContDiv.scrollTop % this.pageWidth; this.move(e) }, this.rightEnd = function () { if (o != "floating") return; o = "stoping", clearInterval(s); var e = -this.scrollContDiv.scrollTop % this.pageWidth; this.move(e) }, this.move = function (e, t) { var n = e / 5; t || (n > this.space && (n = this.space), n < -this.space && (n = -this.space)), Math.abs(n) < 1 && n != 0 ? n = n >= 0 ? 1 : -1 : n = Math.round(n); var r = this.scrollContDiv.scrollTop + n; n > 0 ? this.scrollContDiv.scrollTop + n >= this.listDiv01.scrollHeight ? this.scrollContDiv.scrollTop = this.scrollContDiv.scrollTop + n - this.listDiv01.scrollHeight : this.scrollContDiv.scrollTop += n : this.scrollContDiv.scrollTop - n <= 0 ? this.scrollContDiv.scrollTop = this.listDiv01.scrollHeight + this.scrollContDiv.scrollTop - n : this.scrollContDiv.scrollTop += n, e -= n; if (Math.abs(e) == 0) { o = "ready", this.autoPlay && this.play(), this.accountPageIndex(); return } this.accountPageIndex(), setTimeout("ScrollPicTop.childs[" + this.ID + "].move(" + e + "," + t + ")", this.speed) }, this.next = function () { if (o != "ready") return; o = "stoping", this.move(this.pageWidth, !0) }, this.play = function () { if (!this.autoPlay) return; clearInterval(i), i = setInterval("ScrollPicTop.childs[" + this.ID + "].next()", this.autoPlayTime * 1e3) }, this.stop = function () { clearInterval(i) }, this.pageTo = function (e) { if (o != "ready") return; o = "stoping"; var t = e * this.frameWidth - this.scrollContDiv.scrollLeft; this.move(t, !0) }, this.accountPageIndex = function () { this.pageIndex = Math.round(this.scrollContDiv.scrollLeft / this.frameWidth), this.pageIndex > Math.round(this.listDiv01.offsetWidth / this.frameWidth + .4) - 1 && (this.pageIndex = 0); var e; for (e = 0; e < this.dotObjArr.length; e++) e == this.pageIndex ? this.dotObjArr[e].className = this.dotClassName : this.dotObjArr[e].className = this.dotOnClassName } } var sina = { $: function (objName) { return document.getElementById ? eval('document.getElementById("' + objName + '")') : eval("document.all." + objName) }, isIE: navigator.appVersion.indexOf("MSIE") != -1 ? !0 : !1, addEvent: function (e, t, n) { e.attachEvent ? e.attachEvent("on" + t, n) : e.addEventListener(t, n, !1) }, delEvent: function (e, t, n) { e.detachEvent ? e.detachEvent("on" + t, n) : e.removeEventListener(t, n, !1) }, readCookie: function (e) { var t = "", n = e + "="; if (document.cookie.length > 0) { var r = document.cookie.indexOf(n); if (r != -1) { r += n.length; var i = document.cookie.indexOf(";", r); i == -1 && (i = document.cookie.length), t = unescape(document.cookie.substring(r, i)) } } return t }, writeCookie: function (e, t, n, r) { var i = "", s = ""; n != null && (i = new Date((new Date).getTime() + n * 36e5), i = "; expires=" + i.toGMTString()), r != null && (s = ";domain=" + r), document.cookie = e + "=" + escape(t) + i + s }, readStyle: function (e, t) { if (e.style[t]) return e.style[t]; if (e.currentStyle) return e.currentStyle[t]; if (document.defaultView && document.defaultView.getComputedStyle) { var n = document.defaultView.getComputedStyle(e, null); return n.getPropertyValue(t) } return null } } //show_top(135,'#navhtml','#newsong','topseat'); function show_top(height,obj,obj2,cname){ $(obj2).css("display","none").slideUp(); $(window).scroll(function(){ var scrollTop = $(window).scrollTop(); if(scrollTop >= height && $(obj2).css("display") == "none"){ $(obj2).addClass(cname).slideDown().css("display","block").append($(obj).html()); }else if(scrollTop < height && $(obj2).css("display") == "block"){ $(obj2).removeClass(cname).slideUp().empty().css("display","none"); } }); } // (function($){ $.fn.extend({ Scroll:function(opt,callback){ //参数初始化 if(!opt) var opt={}; var _btnUp = $("#"+ opt.up);//Shawphy:向上按钮 var _btnDown = $("#"+ opt.down);//Shawphy:向下按钮 var timerID; var _this=this.eq(0).find("ul:first"); var lineH=_this.find("li:first").height(), //获取行高 line=opt.line?parseInt(opt.line,10):parseInt(this.height()/lineH,10), speed=opt.speed?parseInt(opt.speed,10):500; //卷动速度,数值越大,速度越慢(毫秒) timer=opt.timer //?parseInt(opt.timer,10):3000; //滚动的时间间隔(毫秒) if(line==0) line=1; var upHeight=0-line*lineH; //滚动函数 var scrollUp=function(){ _btnUp.unbind("click",scrollUp); //Shawphy:取消向上按钮的函数绑定 _this.animate({ marginTop:upHeight },speed,function(){ for(i=1;i<=line;i++){ _this.find("li:first").appendTo(_this); } _this.css({marginTop:0}); _btnUp.bind("click",scrollUp); //Shawphy:绑定向上按钮的点击事件 }); } //Shawphy:向下翻页函数 var scrollDown=function(){ _btnDown.unbind("click",scrollDown); for(i=1;i<=line;i++){ _this.find("li:last").show().prependTo(_this); } _this.css({marginTop:upHeight}); _this.animate({ marginTop:0 },speed,function(){ _btnDown.bind("click",scrollDown); }); } //Shawphy:自动播放 var autoPlay = function(){ if(timer)timerID = window.setInterval(scrollUp,timer); }; var autoStop = function(){ if(timer)window.clearInterval(timerID); }; //鼠标事件绑定 _this.hover(autoStop,autoPlay).mouseout(); _btnUp.css("cursor","pointer").click( scrollUp ).hover(autoStop,autoPlay);//Shawphy:向上向下鼠标事件绑定 _btnDown.css("cursor","pointer").click( scrollDown ).hover(autoStop,autoPlay); } }) })(jQuery);