Horizontal scrolling div

Discussion in 'HTML & Website Design' started by philb, Apr 19, 2012.

  1. #1
    I want to add a bit of creative flair to a new site.

    I want a top fixed menu with a horizontal scrolling content underneath.

    As the visitor clicks the links in the menu, I want the content underneath to scroll to the correct position.

    I've got a basic version running but it's quite right, the content scrolls but is aligned left, I want it to centre in the browser window.

    http://www.netc.pwp.blueyonder.co.uk/bake/

    I'm looking for some help to get the content to centre in browser window.

    Phil

    here's the code I have from a demo I found

    		<script type="text/javascript" charset="utf-8">
    			$(document).ready(function() {
    		       $("#banner a").bind("click",function(event){
    		           event.preventDefault();
    		           var target = $(this).attr("href");
    		           $("html, body").stop().animate({
    		               scrollLeft: $(target).offset().left,
    					   scrollTop: $(target).offset().top
    		           }, 1200);
    		       });
    			});
    		</script>
    Code (markup):
     
    philb, Apr 19, 2012 IP
  2. dasich

    dasich Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    to center block:
    width: 500px;
    margin: 0px auto;
     
    dasich, Apr 19, 2012 IP
  3. philb

    philb Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your help, not sure to work that in.

    I was expecting to have to achieve it by altering the script.

    The scrolling content is styled by

    		.panel {
    			width: 600px;
    			float: left;
    			padding-left: 100px;
    			padding-right: 1040px;
    			margin-top: 100px;
    			color:#FFF;
    }
    Code (markup):
     
    philb, Apr 19, 2012 IP