(function () { var $backToTopTxt = '', $backToTopEle = $('') .appendTo($('body')) .text($backToTopTxt) .attr('title', $backToTopTxt) .click(function () { $('html, body').animate({ scrollTop: 0 }, 120); }), $backToTopFun = function () { var st = $(document).scrollTop(), winh = $(window).height(); st > 0 ? $backToTopEle.show() : $backToTopEle.hide(); //IE6下的定位 if (!window.XMLHttpRequest) { $backToTopEle.css('top', st + winh - 166); } }; $('返回顶部').appendTo($('.go_top')); $(window).bind('scroll', $backToTopFun); $(function () { $backToTopFun(); }); })(); // 实现搜索框下拉的js $(function () { var hit = 10; // 下拉提示列表长度,可修改 var searchBox = $('#searchfield'); var ajaxTimer = null; var delay = 500; // 单位ms /***/ function getParam(key) { var i, paramName; if (location.search) { var params = location.search.slice(1).split('&'); for (i = 0; i < params.length; i++) { paramName = params[i].split('=')[0]; if (paramName === key) { return params[i].split('=')[1]; } } } return null; } /***/ // window.setTimeout(function() { // searchBox.autocomplete({ // source: function(request, response) { // // 输入结束才发送请求 // if (ajaxTimer) { // window.clearTimeout(ajaxTimer); // } // ajaxTimer = window.setTimeout(function () { // // 只有input有值才发送请求 // searchBox.val() !== '' && $.ajax({ // url: 'https://www.pcsoft.com.cn/search/soft/xllb.php', // xhrFields: { // withCredentials: true // }, // dataType: 'json', // data: { // query: searchBox.val() // }, // success: function(data) { // if(data.result.length >= hit) { // response(data.result.slice(0, hit)); // } else { // response(data.result); // } // } // }); // }, delay); // } // }).bind('input.autocomplete', function () { // // 修复Firefox不支持中文 // searchBox.autocomplete('search', searchBox.val()); // }).focus().data( "ui-autocomplete" )._renderItem = function( ul, item ) { // console.log(item); // return $( "
  • " ) // .append( "" + item.value + "" ) // .appendTo( ul ); // }; // }, 0); }); // //隐藏友情链接,空的 // $(document).ready(function () { // var friend = $(' .fLinkTxt').html(); // if ($(this).find(' .fLinkTxt').length == 0) return; // var html = $('.fLinkTxt').parent().siblings().html(); // var reg = /[a-zA-Z]+/; // var index = html.indexOf('友情'); // if (!reg.test(friend) && index == -1) { // $('.fLinkTxt').parent().siblings().css({ display: 'none' }); // } // }); $(function(){ $('.site-nav-box .site-btn').hover(function(){ $('.site-nav-box .site-list').show(); }); $('.site-nav-box .site-list').mouseleave(function(){ $('.site-nav-box .site-list').hide(); }) $(".button").click(function () { var key = $("#searchfield").val(); var url = 'https://www.pcsoft.com.cn/search?c=soft&page=1&key=' + key; window.location.href = url; }) $("#searchfield").keyup(function (e) { if (e.keyCode == 13) { var key = $("#searchfield").val(); if (key == '') { return false; } ; var url = 'https://www.pcsoft.com.cn/search?c=soft&page=1&key=' + key; window.location.href = url; } }); }) $(document).ready(function () { $('.second-menu>.item-box').on('mouseover', function () { $('.second-menu ul').addClass('hide'); $('.second-menu .item-tab').removeClass('on'); $(this).children('ul').removeClass('hide'); $(this).children('.item-tab').addClass('on'); }).on('mouseleave', function () { $('.second-menu ul').addClass('hide'); $('.second-menu .item-tab').removeClass('on'); }); })