list.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. $(function(){
  2. /*栏目图片高度*/
  3. var $lbannerImg = $(".page_title_box").find("img");
  4. var imgsrc = $lbannerImg.attr("src");
  5. if(imgsrc == "" || imgsrc == undefined){
  6. var imgsrc = $lbannerImg.data("imgsrc");
  7. }
  8. //$lbannerImg.attr("src",imgsrc);
  9. $(".page_title_box").css("backgroundImage","url("+imgsrc+")");
  10. var os = function(){
  11. var ua = navigator.userAgent,
  12. isWindowsPhone = /(?:Windows Phone)/.test(ua),
  13. isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone,
  14. isAndroid = /(?:Android)/.test(ua),
  15. isFireFox = /(?:Firefox)/.test(ua),
  16. isChrome = /(?:Chrome|CriOS)/.test(ua),
  17. isTablet = /(?:iPad|PlayBook)/.test(ua) || (isAndroid && !/(?:Mobile)/.test(ua)) || (isFireFox && /(?:Tablet)/.test(ua)),
  18. isPhone = /(?:iPhone)/.test(ua) && !isTablet,
  19. isPc = !isPhone && !isAndroid && !isSymbian;
  20. return {
  21. isTablet: isTablet,
  22. isPhone: isPhone,
  23. isAndroid : isAndroid,
  24. isPc : isPc
  25. };
  26. }();
  27. if(os.isAndroid || os.isPhone || os.isTablet){
  28. scrollTable()
  29. }
  30. if(os.isPhone || os.isTablet){
  31. var idIframe = 'wrapperinner-iframe-t';
  32. $(".wp_articlecontent iframe").each(function(i, iframe){
  33. var idsIframe = idIframe+'-'+i;
  34. $wrapper = $('<div class="wrapperiframe" id="'+idsIframe+'" />');
  35. $(iframe).wrap($wrapper);
  36. var resultContentH = $(iframe).height();
  37. $("#"+ids).height(resultContentH+20);
  38. });
  39. }
  40. function scrollTable(){
  41. setTimeout(function(){
  42. var id = 'wrapperinner-tab-t';
  43. $(".wp_articlecontent table").each(function(i, table){
  44. var ids = id+'-'+i;
  45. $wrapper = $('<div class="wrapperinner" id="'+ids+'" />');
  46. $scroller = $('<div class="scroller" />');
  47. $(table).wrap($wrapper);
  48. $(table).wrap($scroller);
  49. var resultContentH = $(table).height();
  50. $("#"+ids).height(resultContentH+20);
  51. var scroller = new IScroll("#"+ids, { eventPassthrough: true, scrollX: true, scrollY: false, preventDefault: false });
  52. setTimeout(function(){
  53. scroller.refresh();
  54. },60);
  55. $(table).data("scroller", scroller);
  56. });
  57. },30);
  58. }
  59. });