lpnav.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * 动态加载JS
  3. * url JS路径
  4. * callback 回调函数
  5. */
  6. function dynamicLoadJs(url, callback) {
  7. var head = document.getElementsByTagName('head')[0];
  8. var script = document.createElement('script');
  9. script.type = 'text/javascript';
  10. script.src = url;
  11. if(typeof(callback)=='function'){
  12. script.onload = script.onreadystatechange = function () {
  13. if (!this.readyState || this.readyState === "loaded" || this.readyState === "complete"){
  14. callback();
  15. script.onload = script.onreadystatechange = null;
  16. }
  17. };
  18. }
  19. head.appendChild(script);
  20. }
  21. // 调用方法
  22. dynamicLoadJs('/js/housech/menu/iscroll.js',function(){});
  23. dynamicLoadJs('/js/housech/menu/navbarscroll.js',function(){});
  24. $(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. })