Browse Source

增加捐竹子弹窗

zdd 6 years ago
parent
commit
97792c3002

+ 15 - 0
CZKJ.GBRS2.WebMVC/Views/Home/Index.cshtml

@@ -544,6 +544,21 @@
544 544
 
545 545
 
546 546
 
547
+<!-- 捐竹子浮框 -->
548
+<div class="donateWrap" style="display:none">
549
+    <div class="donatePop">
550
+        <div class="img">
551
+            <img src="/assets/homeImg/donate01.jpg" alt="">
552
+        </div>
553
+        <div class="txt">
554
+            <p>恭喜您成为第</p>
555
+            <span class="num">10083</span>
556
+            <p>个喂养“国国”“宝宝”的志愿者</p>
557
+        </div>
558
+        <img class="close" src="/assets/homeImg/clone.png" alt="">
559
+    </div>
560
+</div>
561
+
547 562
 
548 563
 
549 564
 @section script{

BIN
CZKJ.GBRS2.WebMVC/wwwroot/assets/homeImg/clone.png


BIN
CZKJ.GBRS2.WebMVC/wwwroot/assets/homeImg/donate01.jpg


+ 49 - 12
CZKJ.GBRS2.WebMVC/wwwroot/assets/js/newIndex.js

@@ -176,18 +176,55 @@ console.log($('.leftScWrap .sLC:visible')[0].swper)
176 176
 
177 177
 
178 178
 // 点击增加竹子
179
+var ifAdd = false;
179 180
 $('.addLeaf').click(function () {
180
-    if ($('.loveCon .left .img .leafs').hasClass('cli')) {
181
-
181
+    if (ifAdd) {
182
+        alert('您已经捐过竹子了,感谢您的支持')
182 183
     } else {
183
-        $('.addLeaf').css('transform', 'scale(1.08)');
184
-        $('.addLeaf').css('-webkit-transform', 'scale(1.08)');
185
-        $('.loveCon .left .img .leafs').addClass('cli');
186
-        setTimeout(function () {
187
-            $('.loveCon .left .img .leafs').removeClass('cli');
188
-            $('.addLeaf').css('transform', 'scale(1)');
189
-            $('.addLeaf').css('-webkit-transform', 'scale(1)');
190
-        }, 2000)
191
-    }
184
+        if ($('.loveCon .left .img .leafs').hasClass('cli')) {
192 185
 
193
-})
186
+        } else {
187
+            $('.addLeaf').css('transform', 'scale(1.08)');
188
+            $('.addLeaf').css('-webkit-transform', 'scale(1.08)');
189
+            $('.loveCon .left .img .leafs').addClass('cli');
190
+            setTimeout(function () {
191
+                $('.loveCon .left .img .leafs').removeClass('cli');
192
+                $('.addLeaf').css('transform', 'scale(1)');
193
+                $('.addLeaf').css('-webkit-transform', 'scale(1)');
194
+            }, 2000)
195
+            $('.donateWrap').slideDown();
196
+            statusNum();
197
+            ifAdd = true;
198
+        }
199
+    }
200
+})
201
+$('.donateWrap .close').click(function () {
202
+    $('.donateWrap').slideUp();
203
+})
204
+$('.donateWrap').click(function () {
205
+    $('.donateWrap .close').click();
206
+})
207
+$('.donatePop').click(function (event) {
208
+    event.stopPropagation()
209
+})
210
+// 捐竹子数据变化
211
+
212
+function statusNum() {
213
+    var n = Number($('.donateWrap .num').html());
214
+    if (n != NaN) {
215
+        var t = 0;
216
+        var numTime = setInterval(function () {
217
+            t++;
218
+            $('.donateWrap .num').html(t)
219
+            if (t === n) {
220
+                window.clearTimeout(numTime);
221
+                t = 0;
222
+            }
223
+            if (t > 200) {
224
+                window.clearTimeout(numTime);
225
+                $('.donateWrap .num').html(n);
226
+                t = 0;
227
+            }
228
+        }, .01)
229
+    }
230
+}