PDA

View Full Version : Scroll to Top script + Update Iframe? Maybe?



newbie_but_learning
05-09-2012, 09:48 PM
1) Script Title: jQuery Scroll to Top Control v1.1

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/scrolltop.htm

3) Describe problem: Want to augment with an iframe update/refresh, if possible?

+++++++ hi all, newbie here, struggling! ++++++++++

I love the scroll to top script, it's working great for me.

I have a container HTML which loads a big long iframe which is automatically sized. You scroll down the container HTML to view the long iframe html and click the Scroll back to Top button to get back up to the top.

The problem is, I need to "refresh" the iFrame after somebody goes back to the top; the table at the top of the iframe ends up not being aligned correctly otherwise (it drops down a few rows).

I don't know how to do this. I want to add a refresh iframe command to the script, but I can't figure it out.

I see lots of examples from the web, but... I'm too lame to get them to work...

Can you help?

Here are some bits I found:


//reload 1 iframe
$('#iframe').contentWindow.location.reload(true);

//reload all iFrames
$('iframe').each(function() {
this.contentWindow.location.reload(true);
});



<script type="text/javascript">
$(document).ready(function() {
$('#Button1').click(function() {
location.reload();
});
});
</script>

<iframe src="test.html" id="testFrame" width="100" height="343"><a href="test.html">Test</a></iframe>

<script type="text/javascript">
<!--
if (document.getElementById) {
document.write('<button id="reload">Reload</button>')
document.getElementById('reload').onclick = function () {testFrame.location.reload(1)}
}
// -->
</script>

+++++++++

I just can't... get it all working! I'm sorry... I feel lame.