banner.js 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. (function(){var e=function(e){e.synchronizeed=!1;var t=function(){e.synchronizeed=!1},n=function(e){return Array.prototype.slice.call(e,0)};return function(){if(e.synchronizeed)return;e.synchronizeed=!0;var r=n(arguments);r.push(t),e.apply(this,r)}},t=function(){var e=function(){!window.timerProxyTimeout||window.clearTimeout(window.timerProxyTimeout)};return function n(r,i){t.clearProxy=n.clearProxy=e,e(),window.timerProxyTimeout=window.setTimeout(function(){$.isFunction(r)&&r()},i)}}(),n;(function(){var r=0,i=function(e){$(".changing-over .now").removeClass("now"),$(".changing-over>a").eq(e).addClass("now"),r=e},s=e(function(e){var t=arguments[arguments.length-1];if(r===e){t();return}$("#banner_c .banner .pic-intro").hide(),$($("#banner_c .banner .pic-intro")[r]).fadeOut("fast",function(){$($("#banner_c .banner .pic-intro")[e]).fadeIn("fast"),i(e),t()})});n=function(){r=0;var e=$(".changing-over>a").size();$(".changing-over>a").click(function(e){var t=$(".changing-over>a").index($(this));s(t),e.preventDefault()}),$(".changing-over>a").mouseover(function(e){var n=$(".changing-over>a").index($(this));t(function(){s(n)},200),e.preventDefault()}),$(".changing-over>a").mouseout(function(e){t.clearProxy()}),$("#banner_c .banner .pre").click(function(t){s((r+e-1)%e),t.preventDefault()}),$("#banner_c .banner .next").click(function(t){s((r+1)%e),t.preventDefault()});var n=setInterval(function(){s((r+1)%e)},4e3);$(".changing-over").hover(function(){clearInterval(n)},function(){n=setInterval(function(){s((r+1)%e)},4e3)})}})();var r=function(e){this.configSet=e,this.config()};(function(){var e=function(e){return e.replace(/(^\s*)|(\s*$)/g,"")},t={email:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,url:/^(http|https|ftp):\/\/[A-Za-z0-9]+\.[A-Za-z0-9]+[\/=\?%\-&_~`@[\]\/:+!]*([^<>\""])*$/,mobile:/^((\(\d{2,3}\))|(\d{3}\-))?(1[35][0-9]|189)\d{8}$/,"null":/.+/,less400:/^(.|\n){1,400}$/},n=[],i={or:function(e,r){for(var i in e){if(t[i].exec(r))return!0;n.push(e[i])}return n},and:function(e,r){for(var i in e)if(!t[i].exec(r))return n.push(e[i]),n;return!0}},s=function(e){var t="";for(var n=0;n<e.length;n++)t+='<span class="additional-error-message">'+e[n]+"</span>";return t},o=function(t){var r=t.types,o=t.elem,u=t.concat||"or";o.parent().find(".additional-error-message").remove();if(!!t.additional&&t.additional())return!0;n=[];var a=e(o.val()),f=i[u](r,a);return $.isArray(f)?(o.after(s(f)),!1):!0},u=function(e){var t=e.configs;for(var n=0;n<t.length;n++)(function(e){var n=t[e];n.elem.bind("change",function(){o(n)})})(n)},a=function(e){var t=e.callback,n=e.configs,r=!0;for(var i=0;i<n.length;i++)o(n[i])||(r=!1);r&&t()};r.prototype={constructor:r,config:function(){u(this.configSet)},run:function(){a(this.configSet)}}})();var i;(function(){var e=5,t=$("#share"),n=parseInt(t.css("top"));i=function(){$(window).scroll(function(){var r=document.body.scrollTop+document.documentElement.scrollTop;n-r<e?t.css("top",e+r):t.css("top",n)})}})(),$(function(){n()})})();
  2. $(function() {var $li = $("#hot_t>span");var $ul = $("#hot_c>ul");$li.click(function(){var index = $li.index(this);$(this).addClass('curr_tabs').siblings("span").removeClass("curr_tabs");$ul.eq(index).show().siblings("ul").hide();})})
  3. $(function() {
  4. var width=260;//每个图片宽度
  5. var Movement_speed=500;//滚动速度
  6. var Movement_time=3000;//滚动间隔时间
  7. var slideX = {
  8. thisUl: $('#index_course>ul'),
  9. btnLeft: $('#btn_course_lf'),
  10. btnRight: $('#btn_course_rt'),
  11. thisLi: $('#index_course>ul>li'),
  12. init: function () {
  13. slideX.thisUl.width(slideX.thisLi.length * width);
  14. slideX.slideAuto();
  15. slideX.btnLeft.click(slideX.slideLeft).hover(slideX.slideStop, slideX.slideAuto);
  16. slideX.btnRight.click(slideX.slideRight).hover(slideX.slideStop, slideX.slideAuto);
  17. slideX.thisUl.hover(slideX.slideStop, slideX.slideAuto);
  18. },
  19. slideLeft: function () {
  20. slideX.btnLeft.unbind('click', slideX.slideLeft);
  21. slideX.thisUl.find('li:last').prependTo(slideX.thisUl);
  22. slideX.thisUl.css('marginLeft', 0-width);
  23. slideX.thisUl.animate({ 'marginLeft': 0 }, Movement_speed, function () {
  24. slideX.btnLeft.bind('click', slideX.slideLeft);
  25. });
  26. return false;
  27. },
  28. slideRight: function () {
  29. slideX.btnRight.unbind('click', slideX.slideRight);
  30. slideX.thisUl.animate({ 'marginLeft': 0-width}, Movement_speed, function () {
  31. slideX.thisUl.css('marginLeft', '0');
  32. slideX.thisUl.find('li:first').appendTo(slideX.thisUl);
  33. slideX.btnRight.bind('click', slideX.slideRight);
  34. });
  35. return false;
  36. },
  37. slideAuto: function () {
  38. slideX.intervalId = window.setInterval(slideX.slideRight, Movement_time);
  39. },
  40. slideStop: function () {
  41. window.clearInterval(slideX.intervalId);
  42. }
  43. }
  44. $(document).ready(function () {
  45. slideX.init();
  46. })
  47. })