PDA

View Full Version : Scrollable Content



j05hr
Feb 12th, 2010, 01:17 PM
Is there any way to make my scroll bar be able just to scroll the middle content? I have used
overflow: auto which works fine for normal activities but I've got a big contact directory that uses jQuery scrolling and it doesn't work in it.

I know that it is possible to use
position: absolute but I would like to avoid doing this as I would have to rebuild the whole site around it.

So is there any way that you can make the page scroll with jQuery.

Here is what the page looks like.

http://img4.imageshack.us/img4/7395/screenshottky.jpg (http://img4.imageshack.us/i/screenshottky.jpg/)

This is the js file.



$(function(){

$('a[href*=#]').click(function() {

if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {

var $target = $(this.hash);

$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

if ($target.length) {

var targetOffset = $target.offset().top;

$('html,col1').animate({scrollTop: targetOffset}, 1000);

return false;

}

}

});

});


Thanks for the help,
Josh

quartzy
Feb 13th, 2010, 02:04 AM
You are using a php file, not javascript. You need to make sure that the height of the box is of a height that would allow scrolling. And that the overflow: auto; is on the correct div. Not too sure about this, but on www.dynamicdrive.com you can get scripts that would help you to add a scroll box. Good luck