global.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. $(function(){
  2. $('#q-input .text').focus(function(){
  3. if ($(this).val() == $(this).attr('title')) {
  4. $(this).val('').removeClass('tips');
  5. }
  6. }).blur(function(){
  7. if ($(this).val() == '' || $(this).val() == $(this).attr('title')) {
  8. $(this).addClass('tips').val($(this).attr('title'));
  9. }
  10. }).blur().autocomplete({
  11. });
  12. $('#ops').submit(function(){
  13. var $input = $('#q-input .text');
  14. if ($input.val() == $input.attr('title')) {
  15. alert('请先输入关键词');
  16. $input.focus();
  17. return false;
  18. }
  19. });
  20. $(".indexAskList li").hover(function () {
  21. $(this).addClass("hover");
  22. },
  23. function () {
  24. $(this).removeClass("hover");
  25. }
  26. );
  27. $(".expertBox li").hover(function () {
  28. $(this).addClass("now").siblings("li").removeClass("now");
  29. }
  30. );
  31. $(".exproList .exproItem").hover(function () {
  32. $(this).addClass("hover").children(".exproExtra").slideDown("fast").siblings(".exproItem").removeClass("hover");
  33. },
  34. function () {
  35. $(this).removeClass("hover").children(".exproExtra").slideUp("fast")
  36. }
  37. );
  38. $(".agreeThis").hover(function () {
  39. $(this).addClass("agreeThisHover");
  40. },
  41. function () {
  42. $(this).removeClass("agreeThisHover");
  43. }
  44. );
  45. $(".agreeThisDis").hover(function () {
  46. $(this).addClass("agreeThisDisHover");
  47. },
  48. function () {
  49. $(this).removeClass("agreeThisDisHover");
  50. }
  51. );
  52. $("div.msgEntry h3").click(function () {
  53. $(this).siblings(".sysMsgDetail").slideDown("fast");
  54. });
  55. $(".msgDetailUpBtn a").click(function () {
  56. $(this).parents(".sysMsgDetail").slideUp("fast");
  57. });
  58. $('a.loginBtn').click(function(){
  59. $(".loginPanel").slideToggle();
  60. $(this).toggleClass("focus");
  61. if ($(this).hasClass('focus')) $(this).find('span').html('▲')
  62. else $(this).find('span').html('▼')
  63. });
  64. $(".loginPanel").click(function (e) {
  65. e.stopPropagation();
  66. });
  67. $(".userLoginPanel > li").hover(function () {
  68. $(this).addClass("focus").children(".myListMenu").show();
  69. },
  70. function () {
  71. $(this).removeClass("focus").children(".myListMenu").hide();
  72. }
  73. );
  74. function newsScroll(id) {
  75. var box = $("#"+id+ " span");
  76. $("<span>").html(box.html()).appendTo(box.parent());
  77. var w = box.width();
  78. var i = 0;
  79. var move = function () {
  80. box[0].style.marginLeft = -i+"px";
  81. i++;
  82. if (i === w) {
  83. i = 0;
  84. }
  85. };
  86. var auto = setInterval(move, 40);
  87. $("#index-news span a").hover(function (){
  88. clearInterval(auto);
  89. }, function (){
  90. auto = setInterval(move, 40);
  91. })
  92. }
  93. if (document.getElementById("index-news")){
  94. newsScroll("index-news");
  95. };
  96. $(".chargeEntry > h2 > .payBtn").click(function(){
  97. $(this).hide().parents("h2").siblings(".chargeItem").slideDown("fast");
  98. });
  99. $(".chargeItem .btn-gray").click(function(){
  100. $(this).parents(".chargeItem").slideUp("fast").siblings("h2").children(".payBtn").show();
  101. });
  102. $(".chargeEntry").hover(function(){
  103. $(this).addClass("focus").siblings().removeClass("focus")
  104. },
  105. function(){$(this).removeClass("focus")}
  106. );
  107. $(".tabTips").fadeIn("slow");
  108. setTimeout( function(){$( '.tabTips' ).fadeOut("slow");}, 3000 );
  109. $(".searchInput").hover(function () {
  110. $(this).children(".searchDocBtn").show();
  111. },
  112. function () {
  113. $(this).children(".searchDocBtn").hide();
  114. }
  115. );
  116. });