Skip to content

Commit cd170ac

Browse files
committedJan 7, 2014
Add overflow-scrolling example.
1 parent a4ce739 commit cd170ac

File tree

2 files changed

+96
-0
lines changed

2 files changed

+96
-0
lines changed
 
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
6+
<title>
7+
Keep Overflow Content Scrolling Unresponsive Until Clicked Using jQuery
8+
</title>
9+
10+
<style type="text/css">
11+
12+
div.overflowable {
13+
border: 2px solid #FF3399 ;
14+
height: 150px ;
15+
overflow: auto ;
16+
padding: 1px 16px 1px 16px ;
17+
width: 500px ;
18+
}
19+
20+
div.overflowable.unresponsive {
21+
border-color: #CCCCCC ;
22+
cursor: pointer ;
23+
overflow: hidden ;
24+
}
25+
26+
</style>
27+
</head>
28+
<body>
29+
30+
<h1>
31+
Keep Overflow Content Scrolling Unresponsive Until Clicked Using jQuery
32+
</h1>
33+
34+
<p>
35+
Here is a long page; but, on the page, we have another
36+
area of content that can be scrolled independently using
37+
CSS overflow.
38+
</p>
39+
40+
<p>
41+
<strong>Content You Don't Really Care About</strong>:
42+
</p>
43+
44+
<!-- BEGIN: Overflow Content. -->
45+
<div class="overflowable unresponsive">
46+
47+
<p class="repeatMe">
48+
This is the sub-content area - independently scrollable.
49+
</p>
50+
51+
</div>
52+
<!-- END: Overflow Content. -->
53+
54+
<p class="repeatMe">
55+
This is part of the main page content.
56+
</p>
57+
58+
59+
<!-- Load scripts. -->
60+
<script type="text/javascript" src="../../vendor/jquery/jquery-2.0.3.min.js"></script>
61+
<script type="text/javascript">
62+
63+
// When the content area is clicked, remove the "unresponsive"
64+
// class. This will allow the overflow to take on the "auto"
65+
// behavior, instead of the "hidden" behavior.
66+
$( "div.overflowable" ).click(
67+
function( event ) {
68+
69+
$( this ).toggleClass( "unresponsive" );
70+
71+
}
72+
);
73+
74+
// Set up the "filler" content to make the page and the
75+
// sub-content scroll-worthy.
76+
$( "p.repeatMe" ).each(
77+
function() {
78+
79+
var root = $( this );
80+
81+
for ( var i = 0 ; i < 20 ; i++ ) {
82+
83+
root.after( $.clone( this ) );
84+
85+
}
86+
87+
}
88+
);
89+
90+
</script>
91+
92+
</body>
93+
</html>

‎index.htm

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ <h1>
1313
</h1>
1414

1515
<ul>
16+
<li>
17+
<a href="./demos/overflow-scrolling-jquery/">Keep Overflow Content Scrolling Unresponsive Until Clicked Using jQuery</a>
18+
</li>
1619
<li>
1720
<a href="./demos/watch-vs-watch-collection/">$watch() vs. $watchCollection() In AngularJS</a>
1821
</li>

0 commit comments

Comments
 (0)
Please sign in to comment.