[Pro] Iframe page not scrolling to top a linked page

Hello, hope someone can help. I have an iframe embeded in to the page: http://www.dcmotorcycles.co.uk/bikesforsale.html

This is quite a long page, if you scroll down towards the bottom and click the like for more information, it takes you to another page within the iframe. The problem is, is that the new iframe window stays where it is and you need to scroll to the top of the window to see the information. This is a problem as users, do not know this and think the page is black.

I understand that there is some code (like: window.parent.ScrollToTop(); // Scroll to top function) but not sure if this is correct and where it should go as I am not technical on the html side of things.

Hope this all makes sense and someone can help as it’s driving me up the wall!

Thanks in advance

Paul Walker

http://www.dcmotorcycles.co.uk/bikesforsale.html


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Paul,
Try this example;
http://www.freewayactions.com/test/scroll-to-top/

I’ve added a small bit of JavaScript to the iframe so that when it loads the content page it scrolls the parent page back to the top. Simply copy the following code into your Freeway page using Page > HTML Markup > Before ;

<script>
var target = document.getElementsByName("list")[0];
target.onload = function () {
	window.scrollTo(0,0);
}
</script>

The code is a little more complicated that it needs to be simply because there isn’t an easy way to do this if you are using the iFrame Action.
Regards,
Tim.

On 3 Dec 2014, at 14:32, Paul Walker wrote:

Hope this all makes sense and someone can help as it’s driving me up the wall!


Experienced Freeway designer for hire - http://www.freewayactions.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Tim, thats brilliant, just done it and works a treat.

Thanks again.

Paul


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options