Skip to content

Commit 06d6b56

Browse files
committed
First commit.
0 parents  commit 06d6b56

10 files changed

+283
-0
lines changed

README.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a scroller I implemented for the design website Three-OH.com. You can
2+
click on the markers to jump to a particular section and the marker on the
3+
thumb moves relative to the position of the viewframe in the document.

arrow.gif

55 Bytes
Loading

demo.html

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<html>
2+
<head>
3+
4+
<link rel="stylesheet" type="text/css" href="generic.css"/>
5+
<script language="javascript" src="scroll.js"></script>
6+
7+
</head>
8+
<body onload="new ThreeOhScroll('filter')">
9+
10+
<div id="filter" style="position:absolute; left:6px; top:8px; width:290px; height:268px;">
11+
<div id="filterScrollBar" style="position:absolute; left:267px; width:23px; height:268px">
12+
<div id="filterThumbContainer" style="position:absolute; z-index:3; left:13px; top:1px; width:9px; height:266px"><div id="filterThumb" style="position:absolute; top:0px; cursor:pointer; cursor:hand; background-color:#5EBBE7"><img id="filterThumbImg" src="thumb.gif" width="9" height="50" /></div></div>
13+
<div id="filterArrowContainer" style="position:absolute; z-index:4; top:1px; left:10px; width:4px; height:266px"><div id="filterArrow" style="position:absolute"><img id="filterArrowImg" src="arrow.gif" width="4" height="7" /></div></div>
14+
<div id="filterMarkers" style="position:absolute; top:1px; width:9px; height:266px"></div>
15+
</div>
16+
<div id="filterDescription" style="position:absolute; visibility:hidden; z-index:5; font-size:9px; font-family:geneva, tahoma, arial; color:black; background-color:white; padding:2px; padding-bottom:1px; border:1px solid black"></div>
17+
<div id="filterDescArrow" style="position:absolute; visibility:hidden; z-index:6; left:258px; top:2px; width:4px; height:7px; clip:rect(0 4 7 0)"><img src="description.gif" width="4" height="7" /></div>
18+
<div id="filterContainer" style="position:absolute; width:254px; height:267px; overflow:hidden; clip:rect(0 254 267 0)">
19+
<div id="filterContent" style="position:absolute; top:0px">
20+
21+
22+
<p description="Lessrain"><b>16.05.01</b><br />
23+
If you missed the reboot of <a href="http://www.lessrain.co.uk" target="_blank">Lessrain</a>, be sure to check it out as it contains some beautiful portfolio work.
24+
<p description="Sadee"><b>16.05.01</b><br />
25+
Some beautiful typographic work at <a href="http://www.sadee.com/" target="_blank">Sadee</a>, as well as a nice touch of detail.
26+
<p description="Lance Aaron"><b>15.05.01</b><br />
27+
<a href="http://www.lanceaaron.com/" target="_blank">Lance Aaron</a> is a simple, honest and wonderfully observed selection of sketches.
28+
<p description="M 4 + Glitter Port-a-folio"><b>15.05.01</b><br />
29+
<a href="http://www.sodoff.org/mantra/" target="_blank">M 4 + Glitter Port-a-folio</a> (obviously a portfolio site) contains some pretty good form.
30+
<p description="Mike Sheppard"><b>15.05.01</b><br />
31+
Mike Sheppard, former art director at Kioken Inc, and the man behind the motown.com design launches a very impressive <a href="http://www.baseinc.net/" target="_blank">portfolio</a>.
32+
<p description="More OFFF : Snapshots"><b>14.05.01</b><br />
33+
If you're interested, you will find more OFFF snapshots of tired designers and more, <a href="http://exe-prev.nyc1.rareclients.com/barcelona/index.htm" target="_blank">here</a>.
34+
<p description="The Design Culture Network"><b>14.05.01</b><br />
35+
<a href="http://www.relevare.com" target="_blank">Relevare</a> shows us a very interesting approach to navigate.
36+
<br />
37+
38+
<br />
39+
<a href="http://www.designculture.nu" target="_blank">The Design Culture Network</a> is a promotional endeavor of geographically diverse, independent and like-minded websites.
40+
<br />
41+
42+
<br />
43+
<a href="http://badegg.net/chrisjudge" target="_blank">Chris Judge</a> - Personal portfolio site.
44+
<p description="123KLAN"><b>14.05.01</b><br />
45+
Updated <a href="http://www.123klan.com" target="_blank">123KLAN</a> shows off with graffiti-influenced design.
46+
<p description="OFFF : Snapshots"><b>13.05.01</b><br />
47+
Well, here's some evidence of the fun we had at OFFF in Barcelona. Unfortunately the pictures are more touristy rather than documentary.
48+
<br />
49+
50+
<br />
51+
<a href="http://www.threeoh.com/_misc/offf2001/" target="_blank">OFFF : Snapshots</a>
52+
<p description="CANTILEVER chairs"><b>13.05.01</b><br />
53+
A temporary "ebay" announcement for londoners:
54+
<br />
55+
<br />2 <u>original</u> white <a href="http://www.manhattanloft.com/pubimages/PANTON_S-235-333.jpg" target="_blank">CANTILEVER</a> chairs for sale.
56+
<br />Designed 1960 in moulded plastic by <a href="http://www.scandinaviandesign.com/verner_panton/" target="_blank">Verner Panton</a>.
57+
<br />
58+
<br />Interested?
59+
<br />Mail me: james@threeoh.com
60+
61+
62+
63+
</div>
64+
</div>
65+
</div>
66+
67+
</body>
68+
</html>

description.gif

57 Bytes
Loading

generic.css

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
THREE.OH
3+
www.threeoh.com
4+
stream@threeoh.com
5+
*/
6+
7+
8+
/* Generics */
9+
BODY { font:9px verdana, arial, san-serif; }
10+
A {color: #3399CC; text-decoration:none}
11+
A:hover {color: #FF0066}
12+
A:visited {color: #999999}
13+
A:visited:hover {color: #FF0066}
14+
15+
#filter p { margin-top:0px; margin-bottom:20px; }

license.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Copyright 2001, Aaron Boodman
2+
This code is public domain. Please use it for good, not evil.

marker.gif

57 Bytes
Loading

scroll.js

+195
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
// custom scroll application developed for three.oh 3/2001.
2+
// thanks to brandon (www.jesterworld.net) and grant (no site cuz he's too pimp for it) for the help w/ the visuals.
3+
// > youngpup > www.youngpup.net
4+
5+
// optimized for the latest version of {3.0} by bob
6+
7+
ThreeOhScroll.mo5 = navigator.userAgent.indexOf("Gecko") != -1
8+
ThreeOhScroll.ie4 = navigator.appName == "Microsoft Internet Explorer" && document.all
9+
ThreeOhScroll.ie5 = navigator.appName == "Microsoft Internet Explorer" && document.getElementById
10+
ThreeOhScroll.pc = navigator.platform == "Win32"
11+
12+
// this number is for ie4 pc only - which cannot have the description box be of variable width (or atleast i can't figure out how to).
13+
// you set the number of pixels that the desc tag will be permanently.
14+
ThreeOhScroll.ie4pcDescWidth = 100
15+
16+
// i have no idea why this number is necessary, it just is. it is related to how far the scroller is from the top of the window
17+
// in mozilla, but you will have to play with it to get it just right.
18+
ThreeOhScroll.mozAdjust = ThreeOhScroll.mo5 ? 75 : 0
19+
20+
// this is how long it should take the scroller to animate when the user clicks a marker (in milliseconds)
21+
ThreeOhScroll.aniLen = 250
22+
23+
24+
function ThreeOhScroll(id)
25+
{
26+
if (ThreeOhScroll.mo5 || (ThreeOhScroll.ie4 && ThreeOhScroll.pc) || ThreeOhScroll.ie5) {
27+
this.id = id
28+
this.getMembers()
29+
30+
if (ThreeOhScroll.ie4 && !ThreeOhScroll.ie5 && ThreeOhScroll.pc) this.description.style.width = ThreeOhScroll.ie4pcDescWidth
31+
32+
this.clipH = parseInt(this.container.style.height)
33+
this.PTags = ypGetDescendantsByTagName("P", this.content)
34+
var lastP = this.PTags[this.PTags.length-1]
35+
var lastPTop = lastP.offsetTop - ThreeOhScroll.mozAdjust
36+
this.docH = lastPTop + Math.max(lastP.offsetHeight, this.clipH)
37+
this.scrollH = this.docH - this.clipH
38+
this.markersMax = parseInt(this.markers.style.height) - 7
39+
this.thumbMax = parseInt(this.thumbContainer.style.height) - this.thumbImg.height
40+
this.arrowMax = parseInt(this.arrowContainer.style.height) - this.arrowImg.height
41+
42+
this.gRef = "ThreeOhScroll_"+id
43+
eval(this.gRef+"=this")
44+
this.thumb.obj = this
45+
this.thumb.onmousedown = this.startDrag
46+
this.thumb.onmouseover = Function(this.gRef + ".toggleThumb(1)")
47+
this.thumb.onmouseout = Function(this.gRef + ".toggleThumb(0)")
48+
this.thumb.onmouseup = Function(this.gRef + ".toggleThumb(0)")
49+
this.thumb.ondragstart = function() { return false }
50+
this.initMarkers()
51+
} else {
52+
alert ('ha ha!\n\nThe ThreeOh scroller won\'t work for your browser. Don\'t you feel stupid??\n\n I suggest you go get a newer one.')
53+
}
54+
}
55+
56+
ThreeOhScroll.prototype.initMarkers = function() {
57+
var shtml = "", sTitle, iTop
58+
for (var i = 0; i < this.PTags.length; i++) {
59+
sTitle = this.PTags[i].getAttribute("description")
60+
pTop = this.PTags[i].offsetTop - ThreeOhScroll.mozAdjust
61+
iTop = Math.round(pTop * this.markersMax / this.scrollH)
62+
if (sTitle && sTitle != "" && sTitle != null) {
63+
shtml += "<div id='" + this.id + "_marker_" + i + "' "
64+
shtml += "style='position:absolute; left:2px; top:" + (iTop + 2) + "px; "
65+
shtml += "width:5px; height:3px; clip:rect(0 5 3 0); background-color:#CCCCCC; z-index:3;'></div>"
66+
shtml += "<div style='position:absolute; left:0px; top:" + iTop + "px; "
67+
shtml += "cursor:pointer; cursor:hand; width:9px; height:7px; clip:rect(0 9 7 0); z-index:4;' "
68+
shtml += "onmousedown='" + this.gRef + ".scrollTo(" + pTop + ")' "
69+
shtml += "onmouseover='" + this.gRef + ".toggleMarker(this, " + i + ", 1)' "
70+
shtml += "onmouseout='" + this.gRef + ".toggleMarker(this, " + i + ", 0)' "
71+
shtml += "description='" + sTitle.replace(/'/g, "|pos|") + "'>"
72+
shtml += "<img src='x.gif' width='9' height='7'></div>"
73+
}
74+
}
75+
this.markers.innerHTML += shtml
76+
}
77+
78+
ThreeOhScroll.prototype.getMembers = function() {
79+
this.container=ypGetElementById('filterContainer');
80+
this.content=ypGetElementById('filterContent');
81+
this.markers=ypGetElementById('filterMarkers');
82+
this.thumb=ypGetElementById('filterThumb');
83+
this.arrow=ypGetElementById('filterArrow');
84+
this.thumbImg=ypGetElementById('filterThumbImg');
85+
this.arrowImg=ypGetElementById('filterArrowImg');
86+
this.thumbContainer=ypGetElementById('filterThumbContainer');
87+
this.arrowContainer=ypGetElementById('filterArrowContainer');
88+
this.description=ypGetElementById('filterDescription');
89+
this.descArrow=ypGetElementById('filterDescArrow');
90+
}
91+
92+
ThreeOhScroll.prototype.startDrag = function(e) {
93+
if (!e) e = window.event
94+
var ey = e.pageY ? e.pageY : e.clientY
95+
this.dragLastY = ey
96+
this.dragStartOffset = ey - parseInt(this.style.top)
97+
ThreeOhScroll.current = this.obj
98+
document.onmousemove = this.obj.doDrag
99+
document.onmouseup = this.obj.stopDrag
100+
if (this.obj.aniTimer) window.clearInterval(this.obj.aniTimer)
101+
return false;
102+
}
103+
104+
ThreeOhScroll.prototype.doDrag = function(e) {
105+
if (!e) e = window.event
106+
var obj = ThreeOhScroll.current
107+
var ey = (e.pageY ? e.pageY : e.clientY)
108+
var dy = ey - obj.thumb.dragLastY
109+
var ny = parseInt(obj.thumb.style.top) + dy
110+
if (ny >= obj.thumbMax) obj.thumb.dragLastY = obj.thumbMax + obj.thumb.dragStartOffset
111+
else if (ny < 0) obj.thumb.dragLastY = obj.thumb.dragStartOffset
112+
else obj.thumb.dragLastY = ey
113+
ny = Math.min(Math.max(ny, 0), obj.thumbMax)
114+
obj.jumpTo(ny * obj.scrollH / obj.thumbMax)
115+
return false;
116+
}
117+
118+
ThreeOhScroll.prototype.stopDrag = function() {
119+
this.onmousemove = null
120+
this.onmouseup = null
121+
ThreeOhScroll.current.toggleThumb(0)
122+
}
123+
124+
ThreeOhScroll.prototype.scrollTo = function(ny) {
125+
this.endArrow = Math.round(ny * this.markersMax / this.scrollH)
126+
this.startTime = (new Date()).getTime()
127+
this.startPos = parseInt(this.content.style.top) * -1
128+
this.endPos = ny
129+
this.dist = this.endPos - this.startPos
130+
this.accel = this.dist / ThreeOhScroll.aniLen / ThreeOhScroll.aniLen
131+
if (this.aniTimer) this.aniTimer = window.clearInterval(this.aniTimer)
132+
this.aniTimer = window.setInterval(this.gRef + ".scroll()", 10)
133+
}
134+
135+
ThreeOhScroll.prototype.scroll = function() {
136+
var now = (new Date()).getTime()
137+
var elapsed = now - this.startTime
138+
if (elapsed > ThreeOhScroll.aniLen) this.endScroll()
139+
else {
140+
var t = ThreeOhScroll.aniLen - elapsed
141+
var ny = this.endPos - t * t * this.accel
142+
this.jumpTo(ny)
143+
}
144+
}
145+
146+
ThreeOhScroll.prototype.endScroll = function() {
147+
this.jumpTo(this.endPos)
148+
this.arrow.style.top = this.endArrow
149+
this.aniTimer = window.clearInterval(this.aniTimer)
150+
}
151+
152+
ThreeOhScroll.prototype.jumpTo = function(ny) {
153+
this.thumb.style.top = Math.round(ny * this.thumbMax / this.scrollH)
154+
this.arrow.style.top = Math.round(ny * this.arrowMax / this.scrollH)
155+
this.content.style.top = -ny
156+
}
157+
158+
ThreeOhScroll.prototype.toggleMarker = function(oTrigger, markerNum, bOn) {
159+
if (bOn) {
160+
ypGetElementById(this.id + "_marker_" + markerNum).style.backgroundColor = "#444444"
161+
if (this.curMarker) this.toggleMarker(this.curMarker, 0)
162+
this.curMarker = markerNum
163+
this.descArrow.style.top = parseInt(oTrigger.style.top) + 2 + "px"
164+
this.description.style.left = "-400px"
165+
this.description.style.top = "-400px"
166+
this.description.innerHTML = oTrigger.getAttribute("description")
167+
var w = document.all && !ThreeOhScroll.ie5 ? ThreeOhScroll.ie4pcDescWidth : this.description.offsetWidth
168+
this.description.style.left = 259 - w + "px"
169+
this.description.style.top = parseInt(oTrigger.style.top) - 1 + "px"
170+
this.description.style.visibility = "visible"
171+
this.descArrow.style.visibility = "visible"
172+
this.container.style.left = "0px"
173+
} else {
174+
ypGetElementById(this.id + "_marker_" + markerNum).style.backgroundColor = "#cccccc"
175+
this.curMarker = 0
176+
this.description.style.visibility = "hidden"
177+
this.descArrow.style.visibility = "hidden"
178+
}
179+
}
180+
181+
ThreeOhScroll.prototype.toggleThumb = function(bOn) {
182+
//this.arrow.style.backgroundColor = this.thumb.style.backgroundColor = bOn ? "#7CDAFE" : "#5EBBE7"
183+
}
184+
185+
function ypGetChildNodes(objParent) {
186+
return (objParent.childNodes ? objParent.childNodes : objParent.children)
187+
}
188+
189+
function ypGetElementById(id) {
190+
return (document.getElementById ? document.getElementById(id) : document.all ? document.all[id] : false)
191+
}
192+
193+
function ypGetDescendantsByTagName(sTag, objParent) {
194+
return (objParent.getElementsByTagName ? objParent.getElementsByTagName(sTag) : objParent.all && objParent.all.tags ? objParent.all.tags(sTag) : false)
195+
}

thumb.gif

91 Bytes
Loading

x.gif

49 Bytes
Loading

0 commit comments

Comments
 (0)