function removeHtmlTag(value) { return value.replace(/<[^>]*>/g, ''); }; function len(num, value){ if(value.length > num) { return value.substr(0, num) + '...'; } }; function scrollToView (id) { console.log('id: ' + id); document.getElementById(id).scrollIntoView({ block: 'start', inline: 'nearest', behavior: 'smooth' }) } function noticeUp(obj,top,time) { $(obj).animate({ marginTop: top }, time, function () { $(this).css({marginTop:"0"}).find(":first").appendTo(this); }) } $(document).ready(function() { $('.dropdown').hover(function(){ $(this).find('.dropdown-toggle').dropdown('show') }, function(){ $(this).find('.dropdown-toggle').dropdown('hide') }); // 全页面链接 $("#catelink .fixed-func-item-a").each(function (e){ if(!$(this).children('img').attr('src')){ $(this).parent().remove() }else{ let sourceName = $(this).data('name') let name = sourceName.match(/\(([^)]*)\)/)[1] $(this).find('span').html(name) } }) $("#back-top").hide(); //当滚动条的位置处于距顶部100像素以下时,跳转链接出现,否则消失 $(function() { $(window).scroll(function() { if ($(window).scrollTop() > 100) { $("#back-top").fadeIn(1000); $("#back-top a").fadeIn(1500); } else { $("#back-top").hide(); $("#back-top a").fadeOut(1500); } }); //当点击跳转链接后,回到页面顶部位置 $("#back-top").click(function() { $('body,html').animate({ scrollTop: 0 }, 500); return false; }); }); }); /*底部滚动和突出显示栏目*/