Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:15
Links for Scrolling Anchors in an Iframe
Poster: KoalaCookie
Dated: Friday February 10 2006 - 3:24:46 GMT
Since there is a glitch with having simple links to anchors in an iframe, i have resulted to java.
Javascript: Scrolling to anchors in an iframe.
http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../webplus/iframes/iframe_anchor_scroll.htm
The link includes sample and code.
I can't seem to determine the url to use. The script requires:
onclick=return scrollwin(this.href)
and the click/onfunction does not subsitute for the onclick.
Please help with a link or different javascript i could use.
Poster: Ruth
Dated: Friday February 10 2006 - 3:34:57 GMT
Hi,
I'm sorry, I don't understand what you want? This is a forum for support with the Milonic DHTML menu, not a javascript forum.
Ruth
Poster: KoalaCookie
Dated: Friday February 10 2006 - 4:04:55 GMT
I would like to know if the menu could support a link to an anchor in an iframe using the current javascript.
http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../webplus/iframes/iframe_anchor_scroll.htm
<a href="iframe_anchor_scroll2.htm#anchor1" class="scroll_link" onclick="return parent.scroll_win(this.href)">
Can this link be used in the menu
I thought the clickfunction was used as the onclickin the menu.
Thanks for the very quick reply.
Poster: Migru
Dated: Friday February 10 2006 - 7:25:45 GMT
Hi
your JavaScript site/sample page seems to provide very useful tools for "iframers".
I´m going to test certain functions together with the menu.
Targeting an anchor in an iframe is normally achieved by/within the menu, just by url and target, within the menus aI() string(s).
url=file.htm#anchor;target=iframe_id; (*)
of course the id, better id and name have to be defined previously.(<iframe>.............</iframe>)
Michael
*) More or less as it is in html and it works between 2 (or more) iframes in the same way.
http://www.dhyg.de/ uses 4 iframes
Poster: Ruth
Dated: Friday February 10 2006 - 13:13:48 GMT
Hi,
You'll have to find someone who knows about functions to do the auto scroll ones, but for the direct one you would:
1. place the function at the top of the menu data file
2. call the function in the aI strings where you want to use it
Code:
fixMozillaZIndex=true; //Fixes Z-Index problem with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
function goAnchor(id){
anchorPos = window.frames['anchor_iframe'].document.getElementById(id).offsetTop
window.frames['anchor_iframe'].document.body.scrollTop = anchorPos
}
_menuCloseDelay=500;
_menuOpenDelay=150;
_subOffsetTop=2;
_subOffsetLeft=-2;
function goAnchor(id){
anchorPos = window.frames['anchor_iframe'].document.getElementById(id).offsetTop
window.frames['anchor_iframe'].document.body.scrollTop = anchorPos
}
Code:
aI("text=Anchor in Iframe Link;url=javascript:goAnchor('anchor4');");
I don't know how to do the other one, the autoscroll, because it seems to contain two functions and I have no idea how you call two. Actually I think that they have to get wrapped together in order to call them in the menu aI.
Hope this helps.
Ruth
Poster: Migru
Dated: Friday February 10 2006 - 15:07:10 GMT
Hi
I´m sorry but isn´t that a little circumstantial vs. url and target ?
Michael
I will try to get the scroll-one done, as I like the effect of that type of scrolling as
both
Code:
onfunction=myfunction();
which is a "mouseover" andCode:
clickfunction=myfunction()
which is a "mouseclick"
can be used to call something like myfunction() or anyfunction()
Michael
Poster: Ruth
Dated: Friday February 10 2006 - 18:02:16 GMT
Hi,
Migru wrote:
I´m sorry but isn´t that a little circumstantial vs. url and target ?
url=xxx;target=content; but where in the target=content can you get the anchor part of the link? I think that's the problem, getting the anchor part. But, I don't know that the function is necessary, except the one for the scrolling window, which I agree, I like, that's neat.
One should be able to do the anchor link just using the menu, e.g.
Code:
aI("text=Anchor Link;url=javascript:openIFrame('content','http://www.google.com#yourAnchorName');");
This way would also mean putting the required open iframe function on the page Code:
<script>
function openIFrame(iFrameId,winURL)
{
ifId=gmobj(iFrameId)
ifId.src=winURL
}
</script>
function openIFrame(iFrameId,winURL)
{
ifId=gmobj(iFrameId)
ifId.src=winURL
}
</script>
Poster: Migru
Dated: Friday February 10 2006 - 18:49:30 GMT
Hi
its not in the target, where to get the anchor point, it is part of the url, as it is in HTML !
url=file#anchor;
I´m using it multiple, look at my actual testpage
http://www.dhyg.de/
the bottom line shows 30 links all part of a menu, target to anchorpoints of the indexfile of that site. These are not html links, its the menu
embedded_menu_index_right.js
to make it more comfortable for you, see the menu code here
http://www.dhyg.de/embedded_menu_index_right.js
Additional Navigating within the file, once it is called: right click into the iframe
(this part is explained to visitors, actually in German only, once they click on ("Navigieren in dieser Datei"), which is displayed next to each Index
character (alphabetic character, in red color) and is (in English: Navigating within this file).
Michael
Poster: Ruth
Dated: Friday February 10 2006 - 20:50:06 GMT
Of course! I was so focused on 'functions' I forgot all about the plain html i.e. url=link+anchor
Ruth
Poster: KoalaCookie
Dated: Friday February 10 2006 - 23:08:09 GMT
(url=sample.htm#anchor1;target=iframe) and
<a href="sample.htm#anchor1" target="iframe"> causes the the top of the whole frame to move under the browser/address bar. Seems like a common glitch when googled.
openIFrame() works, but stops my media player.
goAnchor() works perfectly. Thank you.
Migru, I hope you are successful in finding away to use the autoscroll with the DHTML menu.
-KoalaCookie-
Poster: Migru
Dated: Saturday February 11 2006 - 0:04:47 GMT
KoalaCookie wrote
Quote:
(url=sample.htm#anchor1;target=iframe) and
<a href="sample.htm#anchor1" target="iframe">
causes the the top of the whole frame to move under the browser/address bar. Seems like a common glitch when googled.
<a href="sample.htm#anchor1" target="iframe">
causes the the top of the whole frame to move under the browser/address bar. Seems like a common glitch when googled.
Would you please give me a url to demonstrate that?
I´m sorry but I´m still of the opinion, that its a little circumstantial (vs. url and target to use an additional function for anchorpoints, because what you call "moving" may have nothing to do with url=sample#anchor1;target=id;
Michael
Poster: KoalaCookie
Dated: Saturday February 11 2006 - 3:57:58 GMT
http://bellsouthpwp.net/K/o/KoalaCookie/pages/menu.htm
Click "Best Freeware" in the DHTML menu.
The "Anti-Spyware" link in the "Best Freeware" DHTML Menu and
the "Anchor6" link above the iframe both show the glitch.
I have made a simple website setup the same way as this one (an iframe within and iframe), but the anchors did NOT mess it up. So something within the iframes are causing the #anchor links to mess up the page. I am guessing.
I bet not many people run into this problem, and goAnchor() solves it.
Just to let you know: I added a larger iframe under the smaller one on the best freeware page. Instead of those links causing the glitch, it scrolls the smaller iframe to the top of the browser, but not under. Hope this make sense.
Under certain circumstances, javascript it needed, but #anchor and target should work most of the time.
Poster: Migru
Dated: Saturday February 11 2006 - 10:15:16 GMT
HI
ok, depends on what is required.
In "normal" applications/html, the file, containing an anchor point is, when targeted, displayed at the upper potentially first position of the window/frame/iframe. That is how im using it (links given above). That is particularly the case, when the file is long enough to scroll within the iframe.
Back to your page:
The way you are using iframe within iframe, I really cannot comment this. There are so many design issues on webpages. Theoretically anything should be possible. However, there is one thing which could be of importance for you too: Opera has a severe problem with iframes. Try to open your page, as it is in Opera. This is why 100% iframes with a menu in it targeting another iframe ( in it ) are not really something to favour.
There could exist a workaround for that (I do not know), or, if not, visitors should be given an information, to use a specific browser only.
The problem you are describing is not a persistent one, as it seems that it is because of the file which starts scrolling (as the iframe already fills 100% in height and width) when an additional information below the iframe
has to be displayed. (http://www.milonic.com/menuproperties.php) So the iframe scrolls.
The main reason, why iframes (as the term indicates "inline frames") were originally designed was to place them within html elements. The way you are using it is a little different. And as a real inline elemet within a table for instance an iframe offers real multiple design options.
Another issue is the use of different monitor resolutions. I don´t know why for instance, on a vertical monitor with 1024x1280 res none of your goAnchor() targets is displayed "visible" within the inner iframe but the "Anti spyware" writing is displayed correct (FF 1.5) whereas in (IE 6.2) it is exactly as you describe it.
Did you try with different settings for heigth and width, and centering the iframe?
Michael