views:

81

answers:

2

I'm using a shadowbox which generates an iframe to display product details on a page. Because the details page can be pretty long, the client would like a "More" button that scrolls the page down (apparently the scrollbar on the right of the iframe isn't enough).

Here's the code that I've tried in order to get the iframe to scroll:

$(document).ready(function()
{
$(".moreButton img").click(function() {
    scrollbottom();
});
});

function scrollbottom() {
var x = 250; // this number is a temporary placeholder
var t = 500;
$("iframe").animate({ scrollTop: x }, t);
}

I've also tried using body instead of iframe but to no avail. Any ideas? Thanks!

A: 

Like this: (Tested)

$("iframe").contents().children().animate({ scrollTop: x }, t);
SLaks
$('iframe').contents().animate({ scrollTop: x }, t);That doesn't seem to be working either.
Chris Stahl
It works for me. (In Firefox, at least)
SLaks
A: 

This ended up working:

$('html,body').animate({ scrollTop: x }, t);
Chris Stahl