|
 |
|
 |
07-24-2007, 11:03 AM
|
#1 (permalink)
|
|
Salchester
Join Date: Jul 2005
Location: In a house
Posts: 230
|
Scrolling Div Problem
Heya,
I have the following code that scrolls text contained inside a div, but when I change the text to two images, the div only scrolls to the end of the first image, and doesn't display the second. Why is this?
Code:
<html>
<head><title></title>
<style>
.Pictures
{
WIDTH: 71px;
HEIGHT: 51px;
MARGIN-LEFT: 12px;
MARGIN-BOTTOM: 12px;
BORDER: 2px solid RGB(255, 255, 255);
}
#clippedDiv
{
POSITION: relative;
WIDTH: 71px;
HEIGHT: 51px;
OVERFLOW: hidden;
}
</style>
<script language="JavaScript" type="text/javascript">
// Scroll code
var timeoutID; // global variable to hold the timer
function scrollDiv(inc,dir) { /* inc(rement) is positive or negative, direction is v(ertical) or h(orizontal) */
if (timeoutID) clearTimeout(timeoutID); // make sure we do not start another timer
var theDiv=document.getElementById('clippedDiv'); // get the hardcoded div
if (theDiv) { // does it exist?
if (dir == "v") theDiv.scrollTop+=inc; /* if vertical scroll increment the scrollTop to move down or up */
else theDiv.scrollLeft+=inc; // else increment scrollLeft to move right or left
timeoutID = setTimeout("scrollDiv(" + inc + ",'" + dir + "')", 20); // do it again in 20 miliseconds
}
}
function stopScroll() { //
if (timeoutID) clearTimeout(timeoutID); // if we have a timerID clear it
}
</script>
</head>
<body>
<div id="clippedDiv"><img class="Pictures" src="Images/1.bmp"><img class="Pictures"src="Images/2.bmp"></div>
<img "../../images/nav/tri-lft.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(-4, 'h');" onmouseout="stopScroll();">
<img "../../images/nav/tri-rt.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(4, 'h');" onmouseout="stopScroll();">
</body>
</html>
__________________
Many Thanks, in advance!
Salchester.
The Future Is Here - Are You Ready?
|
|
|
07-24-2007, 11:19 AM
|
#2 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,505
|
look at the image tag of your second image. tell us what's wrong with it.
__________________
Mike
|
|
|
07-24-2007, 11:58 AM
|
#3 (permalink)
|
|
Salchester
Join Date: Jul 2005
Location: In a house
Posts: 230
|
Scrolling Div Problem
SDE,
What you mean 2.bmp?
__________________
Many Thanks, in advance!
Salchester.
The Future Is Here - Are You Ready?
|
|
|
07-24-2007, 12:35 PM
|
#4 (permalink)
|
|
Newbie
Join Date: Jun 2002
Location: Denmark
Posts: 1,721
|
<img class="Pictures"src="Images/2.bmp">
Now do you see what is wrong, or should it be more specific ?
class="Pictures"src=
Now do you see what is wrong, or should it be more specific ?
="Pictures"s
Now do you see what is wrong, or should it be more specific ?
s"s
Now do you see it ?
|
|
|
07-24-2007, 12:45 PM
|
#5 (permalink)
|
|
Salchester
Join Date: Jul 2005
Location: In a house
Posts: 230
|
Scrolling Div Problem
SDE,
OK, I have changed the code and put a space in, but the second image still doesn't get displayed, when I scroll to it using the right small image (tri-rt.gif).
It just scrolls to the end of the first image, and THAT'S IT.
Why is this?
Code:
<html>
<head><title></title>
<style>
.Pictures
{
WIDTH: 71px;
HEIGHT: 51px;
MARGIN-LEFT: 12px;
MARGIN-BOTTOM: 12px;
BORDER: 2px solid RGB(255, 255, 255);
}
#clippedDiv
{
POSITION: relative;
WIDTH: 71px;
HEIGHT: 51px;
OVERFLOW: hidden;
}
</style>
<script language="JavaScript" type="text/javascript">
// Scroll code
var timeoutID; // global variable to hold the timer
function scrollDiv(inc,dir) { /* inc(rement) is positive or negative, direction is v(ertical) or h(orizontal) */
if (timeoutID) clearTimeout(timeoutID); // make sure we do not start another timer
var theDiv=document.getElementById('clippedDiv'); // get the hardcoded div
if (theDiv) { // does it exist?
if (dir == "v") theDiv.scrollTop+=inc; /* if vertical scroll increment the scrollTop to move down or up */
else theDiv.scrollLeft+=inc; // else increment scrollLeft to move right or left
timeoutID = setTimeout("scrollDiv(" + inc + ",'" + dir + "')", 20); // do it again in 20 miliseconds
}
}
function stopScroll() { //
if (timeoutID) clearTimeout(timeoutID); // if we have a timerID clear it
}
</script>
</head>
<body>
<div id="clippedDiv"><img class="Pictures" src="Images/1.bmp"><img class="Pictures" src="Images/2.bmp"></div>
<img "../../images/nav/tri-lft.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(-4, 'h');" onmouseout="stopScroll();">
<img "../../images/nav/tri-rt.gif" width="12" height="12" alt="" border="0" onmouseover="scrollDiv(4, 'h');" onmouseout="stopScroll();">
</body>
</html>
__________________
Many Thanks, in advance!
Salchester.
The Future Is Here - Are You Ready?
|
|
|
07-25-2007, 01:38 PM
|
#6 (permalink)
|
|
Senior Contributor
Join Date: Mar 2005
Posts: 704
|
Quote:
|
Originally Posted by http://www.htmlgoodies.com/primers/html/article.php/3478181
Even though Internet Explorer will allow you to place an image as a BMP, I wouldn't. No other browsers will be able to display it. Go with .gif or JPEG.
|
So change the images first
__________________

UT: Ultra-kill... God like!
|
|
|
07-26-2007, 03:08 AM
|
#7 (permalink)
|
|
Salchester
Join Date: Jul 2005
Location: In a house
Posts: 230
|
OK done that, now what?
__________________
Many Thanks, in advance!
Salchester.
The Future Is Here - Are You Ready?
|
|
|
07-26-2007, 05:57 AM
|
#8 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,505
|
take the code out of a scrolling div and fix it first.
__________________
Mike
|
|
|
07-26-2007, 06:08 AM
|
#9 (permalink)
|
|
Salchester
Join Date: Jul 2005
Location: In a house
Posts: 230
|
Scrolling Div Problem
SDE,
Both images get displayed when not inside the scrolling div, just not when they are. Why is this?
__________________
Many Thanks, in advance!
Salchester.
The Future Is Here - Are You Ready?
|
|
|
07-26-2007, 06:15 AM
|
#10 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,505
|
i don't know
__________________
Mike
|
|
|
07-26-2007, 06:21 AM
|
#11 (permalink)
|
|
Moderator
Join Date: May 2002
Location: us.ca
Posts: 4,505
|
make sure to tell us when you figure it out so other people searching the forums can learn.
__________________
Mike
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -8. The time now is 03:23 PM.
|
Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
|
 |
|