There are numerous ways to do this, but IMO the best is not to use images, but elements with images in. This way they become more versatile in the future. And also, you'll need javascript to change the images. For that, you'll need a noscript alternative.
so....
Code:
<html>
<head>
<style type="text/css">
*{border:0;padding:0;margin:0;}
ul,li{display:block;position:relative;width:448px;height:336px;float:left;}
li{background:gold;}
ul.tabs{height:32px;}
ul.tabs li{width:32px;height:32px;float:left;}
.container1{width:448px;height:336px;float:left;overflow:hidden;font-size:336px;}
.container1 ul{width:2250px;-webkit-transition:left 1s;}
.container2{display:block;width:224px;height:168px;float:left;overflow:hidden;font-size:168px;}
.container2 ul{display:block;width:224px;height:1008px;-webkit-transition:top 1s;}
.container2 li{width:224px;height:168px;clear:both;}
</style>
<script type="text/javascript">
function dgebi(s){
return document.getElementById(s);
}
function scrollAnchor(obj){
if(obj.indexOf("#")>-1){
a=obj.split("#");
obj=a[1];
}
if(obj_id=dgebi(obj)){
if((dgebi(obj).parentNode.id=="targets")||(dgebi(obj).parentNode.className.indexOf("targets")>-1)){
dgebi(obj).parentNode.scrollTop=parseFloat(obj_id.offsetTop);
dgebi(obj).parentNode.scrollLeft=parseFloat(obj_id.offsetLeft);
} else if((dgebi(obj).parentNode.parentNode.id=="targets")||(dgebi(obj).parentNode.parentNode.className.indexOf("targets")>-1)){
dgebi(obj).parentNode.style.top=-parseFloat(obj_id.offsetTop)+"px"
dgebi(obj).parentNode.style.left=-parseFloat(obj_id.offsetLeft)+"px"
} else {
dgebi(obj).parentNode.scrollTop=parseFloat(obj_id.offsetTop);
dgebi(obj).parentNode.scrollLeft=parseFloat(obj_id.offsetLeft);
}
}
}
window.onload=function(){
a=document.getElementsByTagName("a");
for(i=0;i<a.length;i++){
a[i].onclick=function(){
scrollAnchor(this.href);
return false;
}
}
var current_image=0;
setInterval(function(){
current_image++
scrollAnchor("img"+current_image);
if(current_image>10) current_image=0;
},3000);
}
</script>
</head>
<body>
<div style="position:relative;margin:64px;width:448px">
<ul class="tabs">
<%
for i=1 to 10
response.write "<li><a href=""/scroller/index.asp#img" & i & """ title=""image number " & i & """>" & i & "</a></li>" & vbcrlf
next
%></ul>
<div class="container1 targets">
<ul><%
for i=1 to 5
response.write "<li id=""img" & i & """>" & i & "</li>" & vbcrlf
next
%></ul>
</div>
<div class="container2 targets">
<ul><%
for i=6 to 10
response.write "<li id=""img" & i & """>" & i & "</li>" & vbcrlf
next
%></ul>
</body>
It'll need some tweaking on the css and javascript, but you'll understand what it's doing. It loads all the areas as html, so you've no need to preload images. It also works without javascript and is enhanced with javascript and css transitions, but only webkit. Add others if you wish.
Edit: Sorry, but left the index.asp in. Trying to force myself to learn more or .NET so only .aspx is default! You'll need to tweak the address, or put it in a folder called scroller as a file name index.asp.....
Bookmarks