Jane Wilkie
Jane Wilkie

Reputation: 1743

Dojo: making scrollIntoView more useful

I have a simple function that will scroll down to a div in dojo. I refactored out our help system to display in an external window.

My js function will take the help function (helpfunc - the example you see below is in Catalyst) and will scroll down to (my_anchor), and it does exactly that, it only does just enough to bring it up. I'd like to make it more like HTML's position to an anchor tag. Ideally I could scroll down to div and then somehow scroll even further to bring the div to the top (or further up) the page.

function rolldownTo(my_anchor){
    dojo.window.scrollIntoView(my_anchor);
}

dojo.addOnLoad(function(){rolldownTo([% helpfunc %]);});

Any ideas on how I can pull this off?

I'm only using this method because I haven't been able to find a way in Dojo 1.5 to pop open a window, open a selected tab and move to a selected anchor using a http://<URL>/#anchor style methodology. I can do it using scrollIntoView, trust me, it's complicated since I'm using Catalyst/Dojo1.5.

Upvotes: 2

Views: 1842

Answers (1)

Jane Wilkie
Jane Wilkie

Reputation: 1743

Here's the solution I discovered, just move the <div> to be after the help content. It's a simple solution but it insures that the content shows up.

Upvotes: 1

Related Questions