jQueryプラグイン「Overscroll」は、ブラウザでiPhoneやiPadのスクロールのような動きを再現させることができます。
サンプルを作ってみました。
→ ブラウザでiPhoneやiPadのようなスクロールを実現させるjQueryプラグイン「Overscroll」サンプル
設置も簡単にできますので、見せ方次第では面白い使い方が出来るのではないでしょうか?
【使用方法】
まずはこちらのzoff Design | Overscrollのサイトからファイルを一式ダウンロードします。
※ダウンロードしたファイルにはデモ用のHTMLファイルがありますので、画像以外のコンテンツを使いたい方は参考にしてみて下さい。
まずは、head部分にCSSを記述します。
| 
					 1  | 
						#overscroll { width: 500px; height: 500px; overflow: hidden; border: solid 1px #000; margin: 30px auto; position: relative; }  | 
					
body部分の最後にJavaScriptを記述します。
| 
					 1 2 3 4 5 6 7 8 9 10  | 
						<script src="http://code.jquery.com/jquery-latest.js"></script> <script src="jquery.overscroll.js"></script> <script>  $(function(o){   o = $(document).ready(function(){   $("#overscroll").overscroll();   });  }); </script> </body>  | 
					
そして、表示させたいところに以下を記述して完成です。
| 
					 1 2 3  | 
						<div id="overscroll">      <img alt="" src="test.jpg" /> // 任意のコンテンツ </div>  | 
					
サンプルのソースを書いておきます。どうぞご参考まで。
| 
					 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45  | 
						<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>ブラウザでiPhoneやiPadのようなスクロールを実現させるjQueryプラグイン「Overscroll」サンプル</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> 	#overscroll { 	width: 552px; 	height: 320px; 	overflow: hidden; 	border: solid 1px #000; 	left: 193px; 	top: 22px; } 	#iphone { width: 950px; height: 400px; background-image: url(iphone5_img2.png); background-position: top center ;background-repeat: no-repeat; } </style> </head> <body> 	<h1>jQuery.overscroll</h1>   <div id="iphone"> 	<div id="overscroll"> 			<img alt="" src="test.jpg" /> 	</div>   </div>			 画像:<a href="http://matome.naver.jp/odai/2134072393120416701" target="_blank">「初音ミクの可愛い壁紙とイラスト画像を全力で集めていく」</a>より 参考:NAVERまとめ 	<script src="http://code.jquery.com/jquery-latest.js"></script> 	<script src="jquery.overscroll.js"></script> 	<script> 		$(function(o){ 			o = $(document).ready(function(){             $("#overscroll").overscroll();             }); 		}); 	</script> </body> </html>  | 
					










							
						


コメントを残す