Introduction
In this article we will see how to scroll our page content in the same manner as scrolling in touch screen mobile devices like iPhones. All of you are already aware of scrolling content in mobile devices by finger; such kind of script I'll show you here, how you can achieve this using j-query mobile.
For scrolling the page content I'm using MVC4 and the j-query mobile. You can read more about MVC4 and j-query mobile here. I'm creating this application for our desktop website, not for mobile and to do it I'm using the j-query mobile. So let's get started here.
Step 1:
First you need to download the j-query mobile from here. After downloading j-query mobile, copy the scripts listed below and css files to your server directory.
-
jquery.mobile-1.0.1.min.css
-
jquery.mobile.scrollview.css
-
jqm-docs.css
-
jquery.js
-
jquery.mobile-1.0.1.min.js
-
jquery.easing.1.3.js
-
jquery.mobile.scrollview.js
-
scrollview.js
-
jqm-docs.js
Step 2:
After you have copied all the files and css, add the references to them in your page head section like below.
<link href="../../Srollerjscss/jquery.mobile-1.0.1.min.css" rel="stylesheet" type="text/css" />
<link href="../../Srollerjscss/jquery.mobile.scrollview.css" rel="stylesheet" type="text/css" />
<link href="../../Srollerjscss/jqm-docs.css" rel="stylesheet" type="text/css" />
<script src="../../Srollerjscss/jquery.js" type="text/javascript"></script>
<script src="../../Srollerjscss/jquery.mobile-1.0.1.min.js" type="text/javascript"></script>
<script src="../../Srollerjscss/jquery.easing.1.3.js" type="text/javascript"></script>
<script src="../../Srollerjscss/jquery.mobile.scrollview.js" type="text/javascript"></script>
<script src="../../Srollerjscss/scrollview.js" type="text/javascript"></script>
<script src="../../Srollerjscss/jqm-docs.js" type="text/javascript"></script>
Step 3:
Now copy and paste the following style in the same head section of your aspx page.
<style>
.ui-content.ui-scrollview-clip {
padding: 0;
}
.ui-content.ui-scrollview-clip > div.ui-scrollview-view {
margin: 0;
padding: 15px;
}
.ui-content.ui-scrollview-clip > .ui-listview.ui-scrollview-view {
margin: 0;
}
.square {
width: 98px;
height: 98px;
border: solid 1px #333;
text-align: center;
line-height: 100px;
font-size: 60px;
}
.ui-scrollview-clip .ui-scrollview-clip .square {
background-color: #3CF;
}
.ui-scrollview-clip .ui-scrollview-clip .ui-scrollview-clip .square {
background-color: #F39;
}

Rizkallah SalloumPosted May 26, 2012, 12:58 PM
your scroller sucks like you
Rupal PatelPosted May 25, 2012, 2:28 AM
Hi ..thanks for such a helpful article. Can you please suggest me how to off scrolling/ bouncing , as i need it to be off for some of my pages and need scrolling for some pages. Is there any way?
Amit MaheshwariPosted Feb 10, 2012, 11:06 PM
It's a great effort to accomplish such task, so well keep it up and thanks for sharing............