Display
一、PDF.js 基礎知識
https://github.com/mozilla/pdf.js
二、Rendering PDF Files in the Browser with PDF.js
One of the most popular solutions for rendering PDF files in the browser: PDF.js.
三、案例列表
解決手機端,用微信瀏覽器中預覽pdf文件,並實現手勢放大縮小
然后下載 swipe.js 和 pinchzoom.js 扔到頁面上
[非常好] Swipe-移動觸摸滑動輪播圖插件swipe.js
原文鏈接:http://caibaojian.com/swipe.html
原文鏈接:swipe.js 輕松實現手機端滑動效果
設置選項
-
- startSlide Integer (default:0) - 開始滾動的位置
- speed Integer (default:300) - 動畫滾動的間隔(秒數)
- auto Integer - 開始自動幻燈片(以毫秒為單位幻燈片之間的時間)
- continuous Boolean (default:true) - 創建一個無限的循環(當滑動到所有動畫結束時是否循環滑動)
- disableScroll Boolean (default:false) - 當滾動滾動條時是否停止幻燈片滾動
- stopPropagation Boolean (default:false) - 是否停止事件冒泡
- callback Function - 幻燈片運行中的回調函數
- transitionEnd Function - 動畫運行結束的回調函數
代碼展示:loicminghetti/touchpdf
demo: http://touchpdf.net/demo/index.htm [適用不錯]
This plugin heavily relies on the following great open source work:
-
- PDF.js by Mozilla https://mozilla.github.io/pdf.js/
- PanZoom jQuery plugin by Timmy Willison https://github.com/timmywil/jquery.panzoom
- TouchSwipe jQuery plugin by Matt Bryson https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
四、其他資源
/* implement */
手勢控制
一、anytouch
https://any86.github.io/any-touch/#/
二、swipe.js
插件下載地址
官網:http://www.swipejs.com
github:https://github.com/bradbirdsall/Swipe
插件特色
swipe.js是一個比較有名的觸摸滑動插件,它能夠處理內容滑動,支持自定義選項,你可以讓它自動滾動,控制滾動間隔,返回回調函數等。經常可見使用在移動開發中
三、touch.js
原文鏈接:https://blog.csdn.net/niedewang/java/article/details/80391612
經過測試,使用pdf.js這個開源庫,自己編寫代碼實現pdf 文件瀏覽也不是很復雜。參照我以前的blog文章,如果要實現上一頁,下一頁,旋轉等都非常簡單。
但是,手機端是個比較依賴手勢特殊存在。如果要實現如下功能:
1:雙指放大,通過捏合雙指進行放大或縮小
2:單個手指移動,放大后,通過單指移動,定位到pdf指定的區域
3:左右滑動分頁,比如左滑上一頁,右滑下一頁。
如果要實現如上功能,自己編寫的話,還真不容易。
但有一個現成的開源插件–touch.js .已經實現上述的所有功能,並且還具有章節導航等其他附加功能。
touch.js 是I整合了pdf.js,PanZoom TouchSwipe
等多個開源系統,實現了專用於手機端瀏覽的系統。簡單的說,你想用最小的代碼,想在手機端簡單的瀏覽pdf的話,那么touch,js
是您的最佳選擇
四、付費的方案
End.