Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

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:19

Followscroll and new page query


Poster: fredlongworthhighschool
Dated: Tuesday August 19 2003 - 11:20:16 BST

I am embarassed to ask this, I've turned on the followscroll option as it is much handier to access the menu immediately rather than having to scroll back to the top of the screen.

But, if I select another page, it opens it part way down the screen, at probably the same position I finished browsing the previous page.

I know it's not a menu query, but a HTML referencing one, probably something to do with setting a target anchor, but I'm not sure exactly where. I'm using the IFRAMEs model.

Thanks guys.


Poster: Hergio
Dated: Tuesday August 19 2003 - 14:52:52 BST

Andy, I think I know exactly why this is happening. Think of your page as a picture frame, with the menu following you down the picture. When you get to the bottom, you click the menu to go to a new page and the picture frame's content changes, but you are still looking at the same frame (and the same part of the frame). When you click a menu item, its updating the iframe, not the page you are actually on so whereever you are scrolled to, it stays since only the iframe has been updated. I think I have a good thingthat can help. You know how your iframes call the resizeMe function in the parent? Well have them also call another function called scrollToTop() thats also defined at the top inside the parent, and put it in the try/catch block with the resizeMe call too. Inside your main page (that contains the iframe) declare a function :
Code:
function scrollToTop()
{
   window.location.hash = '';   //These are two single quotes.
}
When you call this from the child On the parent, it will make the main window (your picture frame) rehash itself and since it can't find an anchor called '', it will scroll to the top. Hashing is whats done when you use anchors by the way. If you had an anchor called top, you could location.hash = 'top' and it would be like reloading the page with #top on the end of the URL. (# is also called a hash symbol, get it?) Hope this works!


Poster: fredlongworthhighschool
Dated: Wednesday August 20 2003 - 8:22:06 BST

Good description, thats exactly what is happening.

I've declared the function in the parent but not sure what to put in the child.


Poster: Hergio
Dated: Wednesday August 20 2003 - 16:55:07 BST

Something like the following, where you do the resizeMe thing, you do the scrollToTop thing too. Not sure how you're doing it, but this is the jist.
Code:
<SCRIPT>

try{
    //if I have a parent,make the itmake the iframe as big as me
    parent.resizeMe(id,blah,blahwidth,blahheight);
}catch(e){  /*do nothing */ }
try{
    //if I have a parent, scroll it to the top
    parent.scrollToTop();
}catch(e){ /* do nothing */ }
</SCRIPT>


Poster: fredlongworthhighschool
Dated: Tuesday August 26 2003 - 15:33:14 BST

Sorry for the delay in getting back on this one, but I've had two Windows 2003 servers to install!

Glad to report the function worked ok, it opens up a new page at the top of the screen.


Poster: Hergio
Dated: Tuesday August 26 2003 - 21:31:51 BST

Whoo hoo! :D I had no clue if it would work!...err, I mean, of course it did Andy, what else did you expect from me but 100% working code, all the time? I had no doubts. :oops: No but seriously, glad it worked, I had a feeling it would! ;) Good luck with the Win2003 Servers, I here they are worth the upgrade, both in security and functionality.


Poster: Areometer
Dated: Tuesday September 2 2003 - 7:33:24 BST

Sorry, wrong thread. Wish that there was a delete function...


Poster: Hergio
Dated: Tuesday September 2 2003 - 15:32:16 BST

If you click reply to a thread and decide you dont want to submit anything, nothing is posted until you click submit, so just click BACK on your browser to go back to the forum or click the 'Milonic Forum Index' link in the upper left hand corner of the 'Post a reply' page.