guide.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // 加载一个脚本文件
  2. function _loadJsFile(url, callback) {
  3. var script = document.createElement("script");
  4. if(script.readyState) {
  5. script.onreadystatechange = function() {
  6. if(script.readyState == "loaded" || script.readyState == "complete") {
  7. callback.call();
  8. }
  9. }
  10. } else {
  11. script.onload = callback;
  12. }
  13. script.type = "text/javascript";
  14. //script.async = true;
  15. script.src = url;
  16. //url.indexOf('?') != -1 ? url + '&v=' + version : url + '?v=' + version;
  17. document.getElementsByTagName("head")[0].appendChild(script);
  18. }
  19. //移动端加载js
  20. if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
  21. /* _loadJsFile('js/wapbanner.js'); */
  22. $("#wapguide3").show();
  23. }
  24. // 第三步: 实例化
  25. var anim1 = lottie.loadAnimation({
  26. container: document.getElementById("lottie1"), // 容器
  27. renderer: "svg",
  28. loop: true,
  29. autoplay: true,
  30. // animationData: {}, //如果使用的是JSON
  31. path:
  32. "lottie/tips_click.json" // the path to the animation json
  33. });
  34. var anim2 = lottie.loadAnimation({
  35. container: document.getElementById("lottie2"), // 容器
  36. renderer: "svg",
  37. loop: true,
  38. autoplay: true,
  39. // animationData: {}, //如果使用的是JSON
  40. path:
  41. "lottie/tips_rotate.json" // the path to the animation json
  42. });
  43. anim1.play();
  44. anim1.setSpeed(0.5)
  45. anim2.play();
  46. $("#guide-close").click(function() {
  47. $(".guide").hide();
  48. })