lpnav.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. $(function(){
  2. /**
  3. * 动态加载JS
  4. * url JS路径
  5. * callback 回调函数
  6. */
  7. function dynamicLoadJs(url, callback) {
  8. var head = document.getElementsByTagName('head')[0];
  9. var script = document.createElement('script');
  10. script.type = 'text/javascript';
  11. script.src = url;
  12. if(typeof(callback)=='function'){
  13. script.onload = script.onreadystatechange = function () {
  14. if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
  15. callback();
  16. script.onload = script.onreadystatechange = null;
  17. }
  18. };
  19. }
  20. head.appendChild(script);
  21. }
  22. // 调用方法
  23. dynamicLoadJs('/overseas/js/menu/iscroll.js',function(){});
  24. dynamicLoadJs('/overseas/js/menu/navbarscroll.js',function(){});
  25. $('#wdemo07').navbarscroll({
  26. defaultSelect:0,
  27. scrollerWidth:3,
  28. fingerClick:0,
  29. endClickScroll:function(obj){
  30. // console.log(obj.text())
  31. }
  32. });
  33. })