auto scroll text upwards within div.

Javascript coding ..

Moderators: egami, macek, gesf

Post Reply
Jason_C
New php-forum User
New php-forum User
Posts: 47
Joined: Sat Nov 18, 2006 7:32 am

Wed Mar 28, 2012 6:21 am

How would I get the text inside a DIV to auto scroll.

I wish to place loads of customer reviews in a DIV, but only have the div say 100px high and maybe 100px wide and have the text scroll upwards which would show the rest of the other reviews in the div, then once the div is at the end of the list it would continue from the top and still scroll around upwards like there was no break in the text.

Would I be right in saying that I need to use JavaScript to get this to work? If so does anyone have any suggestions where I might get the code ? Been looking around for a little bit but only finding out how to place a scroll bar in a div and not how to get the div to automatically scroll on its own.

User avatar
gandahar
New php-forum User
New php-forum User
Posts: 112
Joined: Tue Mar 15, 2011 4:05 am

Fri Apr 27, 2012 5:28 pm

try with jQuery, it's very simple to animate scroll

example:

function goToByScroll(id){
$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
}
goToByScroll("anchorId");

you can put an anchor and pass the id to the function

Jason_C
New php-forum User
New php-forum User
Posts: 47
Joined: Sat Nov 18, 2006 7:32 am

Sat Apr 28, 2012 12:59 am

yes everyone is suggesting this one, but i wanting to have the site JS free so it caters for everyone, because the non JS downgrade is not there at all if they have it turned off. and the page look really bad otherwise.

User avatar
minimihi
New php-forum User
New php-forum User
Posts: 236
Joined: Sat Apr 14, 2012 11:57 am
Location: Vilnius, Lithuania

Sat Apr 28, 2012 9:59 am

You want to have such feature without using JavaScript? :D
Well, go to dream about it.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests