Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Scrollable div: Custom graphics ...how?
Old 07-01-2005, 08:32 PM Scrollable div: Custom graphics ...how?
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
I'm sure this has been asked many times before but I couldnt find it anywhere.
I want to make a fixed height div scroll using my own graphics to fit in with my interface but I cant find a script that gives me what I want. I don't need to make a dragable bar just for the div to scroll when the up/down buttons are hovered over.

Any help appreciated
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
 
Register now for full access!
Old 07-01-2005, 09:37 PM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
I assume that the layer will be obscured top and bottom by some part of your interface. In this case it is a simple piece of JavaScript that you need to make the layer scroll, remembering off course the directions (can cause confusion when they hover over a down arrow and the layer scrolls up!).

Obviously you will have two images for the up and down scroll buttons. I'll assume for the purpose of illustration they are called up.jpg and down.jpg - your images should therefore be tagged something like:

Code:
<img src="up.jpg" onMouseOver="timerID=setTimeout('scroll_up()',50)" onMouseOut="clearTimeout(timerID)">
<img src="down.jpg" onMouseOver="timerID=setTimeout('scroll_down()',50)" onMouseOut="clearTimeout(timerID)">
The timer function ensures that whilst the mouse is over the image the relevant scroll function is repeatedly called - you can set the delay between calls by altering the 50 to whatever you feel produces the smoothest effect, remembering that this is a millisecond counter, so 1000 = 1 second.

You will also need the layer itself, so for this we will assume:

Code:
<div id="main" style="position: absolute; left: 300px; top: 100px; width: 400px; height: 400px; z-index: 3; visibility: visible;">Your Content Here</div>
Of course you now need JavaScript functions to control the scrolling:

Code:
<script language="JavaScript>
function scroll_up() {
    d = document.all['main'];
    t = d.style.top;
    t = t - 5; // this would be the pixel scroll per move
    // you will need some kind of error check here to make sure that the top of the layer
    // does not go outside your set parameters - for this example I have taken that to be 0
    if (t <= 0) { t = 0 }
    d.style.top = t;
}
function scroll_down() {
    d = document.all['main'];
    t = d.style.top;
    t = t + 5; // this would be the pixel scroll per move
    // you will need some kind of error check here to make sure that the top of the layer
    // does not go outside your set parameters - for this example this is 300
    if (t >= 300) { t = 300 }
    d.style.top = t;
}
</script>
That should work for you. I will admit that I haven't tested it and have written that on the fly at 2.30 in the morning, but it should work. If it doesn't, give me a shout and I'll sort it for you.
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Old 07-01-2005, 09:40 PM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
Thanks for the reply Im gonna go try it out now. Watch this space for feedback
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 07-01-2005, 09:56 PM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
OK I tried it and firefox said that document.all has no properties...

My div, BTW, is set to overflow:hidden if that makes a difference ..I didnt test it without ...maybe I should have. I might try it with a rectangle clip later unless you know of a fix?

Thanks for your help BTW
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Old 07-01-2005, 10:13 PM
onlyplace4's Avatar
Extreme Talker

Posts: 159
Location: Skegness, Lincolnshire, England
Trades: 0
I'll have a look at that tomorrow and run it through Homesite properly. I know that Firefox's javascript console doesn't like the concept of document.all[], but it works nonetheless (well usually it does) - just that I can never remember the alternative.

I'll set up a simple test page within a table and see what I can come up with. Shouldn't be too hard ... must be sleep depravation that's getting to me
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
onlyplace4 is offline
Reply With Quote
View Public Profile Visit onlyplace4's homepage!
 
Old 07-01-2005, 10:23 PM
brokensoul2271's Avatar
- - - - - - - - -

Posts: 750
Location: Lancashire, UK
Trades: 0
Thank you if I fix it in the mean time i'll let you know ... I'm really bad with javascript but i'll fiddle about with it.

Quote:
must be sleep depravation that's getting to me
Likewise! heh heh
__________________
Yes, indeed...

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
brokensoul2271 is offline
Reply With Quote
View Public Profile Visit brokensoul2271's homepage!
 
Reply     « Reply to Scrollable div: Custom graphics ...how?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.79843 seconds with 12 queries