|
@@ -10,7 +10,9 @@ var plusstar = {}, |
|
@@ -10,7 +10,9 @@ var plusstar = {}, |
10
|
require('../common');
|
10
|
require('../common');
|
11
|
|
11
|
|
12
|
plusstar = {
|
12
|
plusstar = {
|
13
|
- scrollObj: {},
|
13
|
+ common: {
|
|
|
14
|
+ codeDefault: ''
|
|
|
15
|
+ },
|
14
|
init: function() {
|
16
|
init: function() {
|
15
|
var that = this,
|
17
|
var that = this,
|
16
|
$liDom,
|
18
|
$liDom,
|
|
@@ -18,6 +20,13 @@ plusstar = { |
|
@@ -18,6 +20,13 @@ plusstar = { |
18
|
|
20
|
|
19
|
$tabUlDom = $('.plusstar-page .tab-nav ul');
|
21
|
$tabUlDom = $('.plusstar-page .tab-nav ul');
|
20
|
|
22
|
|
|
|
23
|
+ // 重置tab code位置
|
|
|
24
|
+ if (window.localStorage) {
|
|
|
25
|
+ $tabUlDom.find('li').each(function() {
|
|
|
26
|
+ localStorage.setItem($(this).data('code'), 0);
|
|
|
27
|
+ });
|
|
|
28
|
+ }
|
|
|
29
|
+
|
21
|
$tabUlDom.find('li').css({
|
30
|
$tabUlDom.find('li').css({
|
22
|
width: 100 / $tabUlDom.find('li').length + '%'
|
31
|
width: 100 / $tabUlDom.find('li').length + '%'
|
23
|
});
|
32
|
});
|
|
@@ -50,13 +59,10 @@ plusstar = { |
|
@@ -50,13 +59,10 @@ plusstar = { |
50
|
tabNav: function(code) {
|
59
|
tabNav: function(code) {
|
51
|
var that = this;
|
60
|
var that = this;
|
52
|
|
61
|
|
53
|
- if (typeof this.scrollObj[code] === 'undefined') {
|
|
|
54
|
- // 如果不是第一次点击,回顶部
|
|
|
55
|
- $(document).scrollTop(0);
|
|
|
56
|
- this.scrollObj[code] = true;
|
|
|
57
|
- }
|
62
|
+ this.common.codeDefault = code;// 记住最后一次的tab code
|
58
|
|
63
|
|
59
|
loading.showLoadingMask();
|
64
|
loading.showLoadingMask();
|
|
|
65
|
+
|
60
|
$.ajax({
|
66
|
$.ajax({
|
61
|
type: 'GET',
|
67
|
type: 'GET',
|
62
|
url: '/guang/plusstar/resources-template',
|
68
|
url: '/guang/plusstar/resources-template',
|
|
@@ -86,6 +92,11 @@ plusstar = { |
|
@@ -86,6 +92,11 @@ plusstar = { |
86
|
}
|
92
|
}
|
87
|
});
|
93
|
});
|
88
|
}, 40);
|
94
|
}, 40);
|
|
|
95
|
+
|
|
|
96
|
+ // 设置滚动条的位置
|
|
|
97
|
+ if (window.localStorage) {
|
|
|
98
|
+ $(document).scrollTop(localStorage.getItem(code) || 0);
|
|
|
99
|
+ }
|
89
|
},
|
100
|
},
|
90
|
error: function() {
|
101
|
error: function() {
|
91
|
tip.show('网络断开连接了~');
|
102
|
tip.show('网络断开连接了~');
|
|
@@ -116,12 +127,19 @@ $(function() { |
|
@@ -116,12 +127,19 @@ $(function() { |
116
|
$('.tab-nav').css({
|
127
|
$('.tab-nav').css({
|
117
|
position: 'absolute'
|
128
|
position: 'absolute'
|
118
|
});
|
129
|
});
|
119
|
- }
|
|
|
120
|
|
130
|
|
121
|
- if ($footer.length > 0) {
|
|
|
122
|
- $footer.before(
|
131
|
+ $footer.css({
|
|
|
132
|
+ 'max-width': '650px'
|
|
|
133
|
+ }).before(
|
123
|
'<div style="height: ' + parseInt($footer.css('height'), 0) + 'px"></div>'
|
134
|
'<div style="height: ' + parseInt($footer.css('height'), 0) + 'px"></div>'
|
124
|
);
|
135
|
);
|
125
|
}
|
136
|
}
|
|
|
137
|
+
|
126
|
plusstar.init();
|
138
|
plusstar.init();
|
|
|
139
|
+
|
|
|
140
|
+ if (window.localStorage) {
|
|
|
141
|
+ $(document).scroll(function() {
|
|
|
142
|
+ localStorage.setItem(plusstar.common.codeDefault, $(this).scrollTop());
|
|
|
143
|
+ });
|
|
|
144
|
+ }
|
127
|
}); |
145
|
}); |