- Create Account

Is this one good for scrolling an iframe ?

Forums > DHTML Scroller > Is this one good for scrolling an iframe ?
Author
Message

1) telemach Group: Members
Posts: 10 Joined: 26 Nov 2007 Location: IP: 83.144.--.--

This is an excerpt from my sample design :

http://hdd001.republika.pl/scrollbar/test.htm

I need to place a graphic custom vertical scrollbar into green area so the content of an iframe would be scrollable. Can I use this script to get this done or this is more div oriented ? I can wrap the content of source iframe files with <div> if necessary like in this script :

http://www.vicsjavascripts.org.uk/CustomScrollBars/CustomScrollBars.htm

BTW: Is there a good alternative to an iframe ? I mean something that behaves almost exactly same : a) can have transparent background (<object> can't) b) can be addressed by hyperlinks in an easy way (which means that hyperlink doesn't call a js script with a html filename as a parameter).

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
If you're using an IFRAME, just stick with an IFRAME. It's a lot easier to just reconsider your "need" for a custom graphic scrollbar! Really, I don't recommend people use this script anymore.

This script was originally written as an IFRAME alternative back in the day (so yes, it meets the criteria at the end of your post) but these days it's better to use a non-frames site or an AJAX style loading script like my HTMLHttpRequest, or even just an IFRAME, rather than this.

- Angus.

3) telemach Group: Members
Posts: 10 Joined: 26 Nov 2007 Location: IP: 83.144.--.--
>If you're using an IFRAME, just stick with an IFRAME.

I'm using an IFRAME only because this is an easy nesting container that can have transparent background, but I'm open to use anything else like that.

>It's a lot easier to just reconsider your "need" for a custom graphic scrollbar!

It  is not, there is no way back from the layout point where I'm now so I have to find a way to use a graphic scrollbar that can be positioned.

>Really, I don't recommend people use this script anymore.

Really, it turns out that your script might be my only solution.
I wanted to use this modern one :

http://www.hesido.com/web.php?page=customscrollbar

but there is no howto for an iframes and for not having a scrollbar sticked to the container

>This script was originally written as an IFRAME alternative back in the day

so may can work in my case

>(so yes, it meets the criteria at the end of your post)

maybe but I have some problems with an implementation


4) telemach Group: Members
Posts: 10 Joined: 26 Nov 2007 Location: IP: 83.144.--.--
1. I have deleted

<div  id="contentOuter" class="absDiv">
 <div id="contentInner" class="absDiv">
  Sorry, your browser does not support this DHTML script.
 </div>
</div>

from the source document and pasted into iframe content (file like your ds_readme.html ) but it does not work

2. You wrote that :

"**  DO NOT EVER ** nest these scroller DIVs inside tables, paragraphs or any other HTML tags!"

my content (I mean an iframe or a special div with loaded code) is nested in liquid layout under something like 6 other divs and I need to find a way to scroll the content of an iframe

3. Your positioning

divs[n]  = new ScrDiv('ID-of-div', 'Left', 'Top', 'Width',  'Height', Visibility, 'Parent');

applies  to the root page and what if I want to position content and scrollbar within a separate divs ?


>but these days it's better to use a non-frames site or an AJAX style loading script like my HTMLHttpRequest, or even just an IFRAME, rather than this.

OK, but for the present moment I don't know how I can load the content into a nested div and scroll this content with a graphic scrollbar placed in another div.

5) telemach Group: Members
Posts: 10 Joined: 26 Nov 2007 Location: IP: 83.144.--.--
OK, let's assume this sample layout :

http://hdd001.republika.pl/vertical/02.htm

content will be loaded into yellow area and scrollbar should be in the green area (left or right it doesn't matter) so it would scroll the content

size of the container (wrapped with black border) can change and so scrollbar shall

Any chance I'll find a way how to use your scripts to get this working ?

Right  now I've managed to make some use of that old mentioned script, results are here :

http://hdd001.republika.pl/test/02.htm

the outer scrollbar is scrolling but I need to get inner one that will adjust it's height
when container height will change

as you see, what I have now is very crippled, your script is much superior but I still try to figure out how to code it to my layout

Using your script I can place the scrollbar whenever I want and mouse wheel is working. Vic's script is very simple and can control an iframe, your's have desired scrollbar; maybe you can add some code to your script so :

var  content = new DHTMLScroller('content', '');

I  can name="content" the frame.

OK, I found alternative solution :

http://www.dynamicdrive.com/dynamicindex17/iframescroll.htm

and so my example looks like this :

http://hdd001.republika.pl/test/03.htm  (unfortunatelly no knob)

and maybe this can help in adding iframe feature to your script


6) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
I don't have any major plans to modify this script, but I'm glad that you have found some options!

If you do use this script please be aware that it was built specifically as as IFRAME replacement. You do not need an IFRAME at all in your document. This can load and scroll files, you can apply your image elements to the scrollbar, and it contains its own positioning engine too. If you really want to, you can do your layout just as you describe using this script alone.

- Angus.

7) telemach Group: Members
Posts: 10 Joined: 26 Nov 2007 Location: IP: 83.144.--.--
>I don't have any major plans to modify this script,

major  ??? this Dynamic Drive code is so short, I think that you are able to write something like that as an add-on to your script, IMHO this is what donations are also for

>and it contains its own positioning engine too.

but what worries me is the fact that this positioning is for root page and not a specified div

btw: I have some problems while loading/reloading page under FF & Safari, browser just hangs on 'please wait'

don't you think that getting a slider for this Dynamic Drive script can be an easier way than redesigning the whole page ?

8) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.109.--.--
It's not technical difficulty. It's the fact that in my opinion, custom scrollbars are just a plain bad idea.

They're OK if you're on a desktop browser, but what if you're on a PDA/iPhone/etc? Using a screenreader? Other accessibility aids? Run into edge cases where you drag the cursor outside the window etc? Scrollbars are much harder than you think to code (just scrolling something up and down is a one-line JS command), and a little pointless when each and every browser already gives you a 100% debugged and working one for free!

As such, I'm devoting my development efforts to my newer "DOM" scripts rather than these older scripts (which are hamstrung by Netscape 4 compatibility, that's the reason script elements should be in the root of the document -- if you're not worried about NS4, you can freely nest them!). The HTMLHttpRequest script, which is the successor to this one, simply uses CSS "overflow" scrolling which is much more compatible.

If you really want to write a JavaScript based scrollbar for an IFRAME, well, feel free to try it as a challenge, but be aware that cross-frame scripting is full of all sorts of interesting tricks of its own too as each frame is counted as a completely separate window :).

-  Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.