Exemplo n.º 1
0
		menu.each(function(index, element) {
            var This = $(this);
			var current = This.find('a.current');
			var topNav = This.find('a').first();
			if(current.length>0){
				topNav.addClass('current')
			}
			
        });
Exemplo n.º 2
0
	// 返回顶部
	function backTop(){
		var maxScroll = 500;
		var backTopBtn = $('.footer .backtop');
		var win = $(window);
		var scrollTop = win.scrollTop(); 
		function init(val){
			val>=maxScroll?backTopBtn.css({'display':'block'}):backTopBtn.css({'display':'none'});
		};
		
		$(window).on('scroll',function(){
			scrollTop = win.scrollTop(); 
			init(scrollTop);
		});
		
		backTopBtn.on('click',function(){
			document.documentElement.scrollTop = document.body.scrollTop =0;
		});

		init(scrollTop);
	};
Exemplo n.º 3
0
		times.each(function(){
			var time = $(this);
			var date = time.text();
			var calendar = dater(date);
			var newDate = calendar.era;
			if(calendar.ster!==''){
				newDate += '<a href="#" class="link-important">' +calendar.ster +'</a>'
			}else{
				newDate += '<i class="icon">&#xe64e;</i>'
			};
			time.html(newDate).attr('title',date)
		})
Exemplo n.º 4
0
		menu.on('click',function(){
			var This = $(this);
			var thisShow = This.find('dl');
			var hasShow = thisShow.hasClass('show');
			if(thisShow.length){
				if(hasShow){
					hide(This);
				}else{
					if(isShow && isShow.length){
						hide(isShow);
					};
					show(This,function(){
						docClick();
					})
				}
			}
		})
Exemplo n.º 5
0
	function share(options){
		var title = document.title;
		var img = $('.global-post img')[0]
		img = img?img.src:'';
		window._bd_share_config = {
			"common": {
				"bdText": title,
				"bdMini": "1",
				"bdPic": img,
				"bdStyle": "1",
				"bdSize": "0"
			},
			"share": {}
		};
		
		var jsSrc = 'http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+ ~ ( - new Date() / 36e5);
		var head = document.getElementsByTagName('head')[0]||body;
		var js = document.createElement('script');
		js.src = jsSrc + ~ ( - new Date() / 36e5);
		head.appendChild(js);
		js = null;
	}
Exemplo n.º 6
0
	// 二级菜单
	function headerMenu(){
		var menu = $('.menu li');
		var isShow =null;
		var doc = $(document);
		
		menu.each(function(index, element) {
            var This = $(this);
			var current = This.find('a.current');
			var topNav = This.find('a').first();
			if(current.length>0){
				topNav.addClass('current')
			}
			
        });
		
		function show(root,callback){
			var subNav =  root.find('dl');
			if(subNav.length){
				var arrow = root.find('li a i.icon'); 
				arrow.addClass('current');
				subNav.addClass('show');
				isShow = root;
				'function' == typeof callback && callback();
			}	
		};
		function hide(root){
			var subNav =  root.find('dl');
			if(subNav.length){
				var arrow = root.find('li a i.icon'); 
				arrow.removeClass('current');
				subNav.removeClass('show');
			};
			doc.off('click')
		};
		function docClick(){
			setTimeout(function(){
				doc.on('click',function(){
					if(isShow){
						hide(isShow);
					};
				})	
			},0) ;	
		}

		
		menu.on('mouseenter',function(){
			show($(this));
		});
		menu.on('mouseleave',function(){
			hide($(this));
		});
		menu.on('click',function(){
			var This = $(this);
			var thisShow = This.find('dl');
			var hasShow = thisShow.hasClass('show');
			if(thisShow.length){
				if(hasShow){
					hide(This);
				}else{
					if(isShow && isShow.length){
						hide(isShow);
					};
					show(This,function(){
						docClick();
					})
				}
			}
		})
	};
Exemplo n.º 7
0
		menu.on('mouseleave',function(){
			hide($(this));
		});
Exemplo n.º 8
0
		menu.on('mouseenter',function(){
			show($(this));
		});