special.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. $(function() {
  2. var specialId = GetQueryString("special_id");
  3. $.ajax({
  4. url: ApiUrl + "/index.php?act=index&op=special&special_id=" + specialId,
  5. type: 'get',
  6. dataType: 'json',
  7. success: function(result) {
  8. var data = result.datas;
  9. var html = '';
  10. $.each(data, function(k, v) {
  11. $.each(v, function(kk, vv) {
  12. switch (kk) {
  13. case 'adv_list':
  14. case 'home3':
  15. $.each(vv.item, function(k3, v3) {
  16. vv.item[k3].url = buildUrl(v3.type, v3.data);
  17. });
  18. break;
  19. case 'home1':
  20. vv.url = buildUrl(vv.type, vv.data);
  21. break;
  22. case 'home2':
  23. case 'home4':
  24. vv.square_url = buildUrl(vv.square_type, vv.square_data);
  25. vv.rectangle1_url = buildUrl(vv.rectangle1_type, vv.rectangle1_data);
  26. vv.rectangle2_url = buildUrl(vv.rectangle2_type, vv.rectangle2_data);
  27. break;
  28. }
  29. html += template.render(kk, vv);
  30. return false;
  31. });
  32. });
  33. $("#main-container").html(html);
  34. $('.adv_list').each(function() {
  35. if ($(this).find('.item').length < 2) {
  36. return;
  37. }
  38. Swipe(this, {
  39. startSlide: 2,
  40. speed: 400,
  41. auto: 3000,
  42. continuous: true,
  43. disableScroll: false,
  44. stopPropagation: false,
  45. callback: function(index, elem) {},
  46. transitionEnd: function(index, elem) {}
  47. });
  48. });
  49. }
  50. });
  51. });