new address block handle
Showing
1 changed file
with
10 additions
and
8 deletions
@@ -287,13 +287,7 @@ function newAddress(isInit) { | @@ -287,13 +287,7 @@ function newAddress(isInit) { | ||
287 | address.show(); | 287 | address.show(); |
288 | } | 288 | } |
289 | 289 | ||
290 | -// 显示全部地址 | ||
291 | -$('.address-all').click(function() { | ||
292 | - $(this).siblings('.address-list').removeClass('shrink').end().addClass('vhide'); | ||
293 | -}); | ||
294 | - | ||
295 | -// 新增地址 | ||
296 | -$('.new-address, .new-address-block').click(function() { | 290 | +function newAddressHandle() { |
297 | 291 | ||
298 | // 判断是否超过20条地址 | 292 | // 判断是否超过20条地址 |
299 | if ($('#address-list .address').length >= 20) { | 293 | if ($('#address-list .address').length >= 20) { |
@@ -302,8 +296,16 @@ $('.new-address, .new-address-block').click(function() { | @@ -302,8 +296,16 @@ $('.new-address, .new-address-block').click(function() { | ||
302 | } | 296 | } |
303 | 297 | ||
304 | newAddress(); | 298 | newAddress(); |
299 | +} | ||
300 | + | ||
301 | +// 显示全部地址 | ||
302 | +$('.address-all').click(function() { | ||
303 | + $(this).siblings('.address-list').removeClass('shrink').end().addClass('vhide'); | ||
305 | }); | 304 | }); |
306 | 305 | ||
306 | +// 新增地址 | ||
307 | +$('.new-address').click(newAddressHandle); | ||
308 | + | ||
307 | $('.address-list').on('click', '.address', function() { | 309 | $('.address-list').on('click', '.address', function() { |
308 | 310 | ||
309 | // 地址切换 | 311 | // 地址切换 |
@@ -403,7 +405,7 @@ $('.address-list').on('click', '.address', function() { | @@ -403,7 +405,7 @@ $('.address-list').on('click', '.address', function() { | ||
403 | } | 405 | } |
404 | }); | 406 | }); |
405 | e.stopPropagation(); | 407 | e.stopPropagation(); |
406 | -}); | 408 | +}).on('click', '.new-address-block', newAddressHandle); |
407 | 409 | ||
408 | // 页面加载时请求地址列表,若有则展示列表;若无则直接显示新建弹窗并不可被关闭 | 410 | // 页面加载时请求地址列表,若有则展示列表;若无则直接显示新建弹窗并不可被关闭 |
409 | $.ajax({ | 411 | $.ajax({ |
-
Please register or login to post a comment