views:

57

answers:

4

Hello! I have an iframe in my page and i want to create a button that when i press it the page in the iframe scrolls down...

Can anyone help?

A: 

I believe this article answers it better than I ever would - http://flesler.blogspot.com/2007/10/jqueryscrollto.html

Let me elaborate:

I've used flesler's library before for the same purpose(scrolling an iFrame inside a facebook application, same deal more or less) and it's honestly beautiful. The linked article explains several detailed situations in how you'd use scrollTo, and it works nicely.

Daman
I checked it quickly.Thank you. Do i have to download a plygin?
Xara
I would also appreciate it if you could give me an example... i didnt see anything in the link you sent me! Thanks in advance
Xara
A: 

You can scroll an iFrame using Javascript with the scrollTo and scrollBy methods. This has been discussed here before, and the answer there has a simple example:

http://stackoverflow.com/questions/2365567/how-to-scroll-an-iframe-using-javascript

Dan M
nothing with this code works ...
Xara
A: 

To use flesler, you can do

<div id="pane-target" class="pane">
  <iframe style="width:1000px; height:1000px" src="MyInformation.html"></iframe>
</div>
mplungjan
i have this code and trying to use flsler
Xara
<div id="left">«</div> <div id="right">»</div> <div id="block"><iframe src="http://www.ipolistonkosmo.gr /theater.php?all=yes" id="cinframe" name="cinframe" frameborder="no" scrolling="auto" ></iframe></div><script>//$("#cinframe")._scrollable();$("#right").click(function(){ $("#block cinframe").scrollTo( '+=340px', { axis:'y' } );}); $("#left").click(function(){ $("#block cinframe").scrollTo( '-=340px', { axis:'y' } ); }); </script>
Xara
And does that work for you?
mplungjan
no it doesnt but i found the answer...
Xara
scroll up and see the answer :) its the answer #4 !!
Xara
Ah - I see now it was your own comment. Thanks
mplungjan
A: 

$("#scrolldownbut").click(function() {

var q=$("#theframe").scrollTop();

  q=q+100;
$("#theframe").scrollTop(q);

return false;
});

this code works fore me... the frame's id and name is theframe and the scrollbut is a div to scroll down the frame. Notice: the frames width and height must not be in percentage (thats what i wanted to do) because in percentage it doesnt work...

Xara