scripts.html
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!-- Le javascript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="__TMPL__/public/assets/simpleboot3/bootstrap/js/bootstrap.min.js"></script>
<script src="__STATIC__/js/frontend.js"></script>
<script>
$(function(){
$("#main-menu li.dropdown").hover(function(){
$(this).addClass("open");
},function(){
$(this).removeClass("open");
});
$("#main-menu a").each(function() {
if ($(this)[0].href == String(window.location)) {
$(this).parentsUntil("#main-menu>ul>li").addClass("active");
}
});
$.post("{:url('user/index/isLogin')}",{},function(data){
console.log(data);
if(data.code==1){
if(data.data.user.avatar){
}
$("#main-menu-user span.user-nickname").text(data.data.user.user_nickname?data.data.user.user_nickname:data.data.user.user_login);
$("#main-menu-user li.login").show();
$("#main-menu-user li.offline").hide();
}
if(data.code==0){
$("#main-menu-user li.login").hide();
$("#main-menu-user li.offline").show();
}
});
;(function($){
$.fn.totop=function(opt){
var scrolling=false;
return this.each(function(){
var $this=$(this);
$(window).scroll(function(){
if(!scrolling){
var sd=$(window).scrollTop();
if(sd>100){
$this.fadeIn();
}else{
$this.fadeOut();
}
}
});
$this.click(function(){
scrolling=true;
$('html, body').animate({
scrollTop : 0
}, 500,function(){
scrolling=false;
$this.fadeOut();
});
});
});
};
})(jQuery);
$("#backtotop").totop();
});
</script>