/** * @namaspace: * @description: * @author:lanyf * @update:Created by lanyf on 17/4/25 . * @version: 1.0 */ $(function () { $('ul.nav-list>li').hover(function(){ $(this).children('.side-nav').show(); },function(){ $(this).children('.side-nav').hide(); }); $('div.select').hover(function(){ $(this).children('.option').show(); },function(){ $(this).children('.option').hide(); }); $('#map').click(function(){ $('div.city-map').toggle(500); $('#map i').toggleClass('down'); }); $('#print').click(function(){ window.print(); }); var tabNav = $('.title-grid a'); var tabCon = $('.grid-div div'); var nowclass = 'active'; tabNav.hover(function(){ var index=tabNav.index(this); $(this).siblings().removeClass(nowclass); $(this).addClass(nowclass); tabCon.eq(index).siblings().hide(); tabCon.eq(index).show(); }); //点击查看大图功能 $('.article img').click(function(){ var src = $(this).attr('src'); if(src.indexOf('littlepic')!=-1||src.indexOf('midpic')!=-1){ src = src.replace(/littlepic/, 'uploadpic'); src = src.replace(/middlepic/, 'uploadpic'); $('body').append('
×
'); $('.img-win').css({ width:$(window).width()*0.8, height:$(window).height()*0.8, marginLeft:-($(window).width()*0.8*0.5), marginTop:-($(window).height()*0.8*0.5) }); $('.img-opacity').show(); console.log($('#addImg').width()); } }); $(document).on('click', '.img-close,#addImg', function(){ if (!('remove' in Element.prototype)) { Element.prototype.remove = function() { if ($('.img-opacity').parentNode) { $('.img-opacity').parentNode.removeChild(this); } }; }else{ $('.img-opacity').remove(); } }); (function () { var date = new Date(); var year = date.getFullYear(); var mouths = date.getMonth()+1; var day = date.getDate(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); var weekDay = new Array(7); weekDay[0] = "星期日"; weekDay[1] = "星期一"; weekDay[2] = "星期二"; weekDay[3] = "星期三"; weekDay[4] = "星期四"; weekDay[5] = "星期五"; weekDay[6] = "星期六"; document.getElementById("ttime").innerHTML=" "+year+"年"+mouths+"月"+day+"日"+" "+weekDay[date.getDay()]; //获得当前时间,刻度为一千分一秒 // var timeID = setTimeout(displayDate,1000); }) (); // displayDate(); $( '.tab-cur a' ).on( 'mouseover', function() { // console.log( $(this).index() ); var _index = $(this).index(); // console.log(); $(this).parents( '.m-box3' ).find( '.tab-list:eq('+_index+')').addClass( 'show' ).siblings().removeClass( 'show' ); }) });