PDA

View Full Version : scrolling two (or more) iframes



musatv
08-14-2006, 02:43 PM
i have two iframes in the same window, each with its own set of up/down arrows for vertical scrolling. first test showed that each pair of arrows triggers the scolling action in both iframes, which was rather inconvenient. being determined to have each iframe individually triggered by only its related arrows, i have tried, but failed, to identify any reference in the code to the target of the scrolling action (i am inexperienced in java script, and my search was rather intuitive). i would greatly appreciate if anyone could help with solving this issue.

thanks heaps,
victor

musatv
08-14-2006, 02:47 PM
iframe code used from: http://www.dynamicdrive.com/dynamicindex11/scrollc2.htm

btelecky
08-14-2006, 08:18 PM
is it possible to make the first iframe large enough so you don't need to scroll the exterior iframe and just make the interior iframe scrollable? Or is there too much information to pull that off?

I am also a novice when it comes to javascript and such, the only scrolling option I see in the iframe object regarding scrolling capabilities is either to activate it or deactivate it...

I'm just a layout junkie, and in that respect I think it would be cumbersome to the user scroll through two iframe interfaces. That's why I would suggest creating the first iframe to be large enough to hold the secondary iframe and allow that one to be scrollable.

ddadmin
08-15-2006, 05:37 AM
You'll want to check out John's update to this script, which includes several improvements: http://home.comcast.net/~jscheuer1/side/index_side_table.htm

jscheuer1
08-15-2006, 06:43 AM
Actually DD, that turns out to have been the beta version. As mentioned later in the thread that introduces it, this is a more x browser version:

http://home.comcast.net/~jscheuer1/side/index_side_table.htm

Neither of these nor the script link mentioned by musatv uses iframes though.

ddadmin
08-15-2006, 10:52 PM
Ops, URL updated. I'm going to post this script to DD soon.


Neither of these nor the script link mentioned by musatv uses iframes though.

I was a little confused as well. But anyhow, to musatv, the only script on DD that does scroll an iframe would be: http://dynamicdrive.com/dynamicindex17/iframescroll.htm

musatv
08-15-2006, 11:27 PM
thanks a lot guys. my problem is not scrolling an iframe, have used the DD script a lot so far, with one frame, but how to adjust the code to make the arrows address only the iframe to which it is attached (at the moment, as in: http://www.themarqueerocks.com/, both sets of arrows will trigger scrolling in both iframes at once).

jscheuer1
08-16-2006, 05:13 PM
To get the effect of two or more scrollers on your page, you have two basic choices, you can use an on page scroller, such as the one you first mentioned in this thread, modified for multiple usage on a page like the one shown here:

http://home.comcast.net/~jscheuer1/side/index_side_table.htm

Or, you can adapt the iframe scroller that you are using. To do that, each scroller must have its own scrollspeed variable. So the for first one, you can use the script 'as is'. For the second, make these changes to the controls:


<div style="width:150px;" align="right">
<a href="#" onMouseover="scrollspeed2=-2" onMouseout="scrollspeed2=0">Up</a> | <a href="#" onMouseover="scrollspeed2=2" onMouseout="scrollspeed2=0">Down</a>
</div>

And on the script on its content page:


function initialize(){
if (window.parent.scrollspeed2!=0){
speed=window.parent.scrollspeed2
scrollwindow()
}
}

For yet more scrollers, use scrollspeed3 and so on.

Notes: There are relative advantages and disadvantages to each method.

musatv
08-17-2006, 09:36 AM
thanks a lot john, can see what you mean.
that helps a lot