开发者

jquery localscroll overflow problem

开发者 https://www.devze.com 2023-04-05 15:18 出处:网络
It seems to be a known issue, I\'m using the localscroll plugging to scroll the sections HORIZONTALLY in a div#content, by clicking #navigation ul li a. So the #content is an overflow: hidden div. Ori

It seems to be a known issue, I'm using the localscroll plugging to scroll the sections HORIZONTALLY in a div#content, by clicking #navigation ul li a. So the #content is an overflow: hidden div. Originally the #content is centered on the page, that means there is a space between the top of the window to the content. Whenever one of the #navigation ul li a is clicked, the hash is changed, cos I set the hash: true for the plugging cos I still wanna use the back button. The problem is this anchor tag change scrolls the content right on the #content and crops the top space out. There looks to be contradict forces in action here. How do I keep the #content centered still. Here is the structure:

<div id="container">
<div id="top"></div>
<div id="floater></div>
<div id="content">// this is centered on screen originally, but it will just keep on top after the scroll and cropping the whole space on top
   <div class="section"><ul id="1">content 1</ul></div>
   <div class="section"><ul id="2">content 2</ul></div>
   <div class="section"><ul id="3">content 3</ul><开发者_Python百科/div>
   <div class="section"><ul id="4">content 4</ul></div>
</div>
<div id="navigation">
   <ul>
      <li><a href='#1'>1</a></li>
      <li><a href='#2'>2</a></li>
      <li><a href='#3'>3</a></li>
      <li><a href='#4'>4</a></li>
   </ul>
</div>
</div>

setting for localscroll:

$.localScroll.defaults.axis = 'xy';

$.localScroll.hash({
        target: '#content',
        queue:true,
        duration:1500
    });

$.localScroll({
    target: '#content',
    queue:true,
    duration:1000,
    hash:true,
    onBefore:function( e, anchor, $target ){
    },
    onAfter:function( anchor, settings ){
    }
});

UPDATE: here are some css:

html, body  { height:100%; margin:0; padding:0; }
#container  { height:100%; min-width: 900px; min-height:630px; background:#dddbd9 url('../images/bg.jpg') no-repeat center center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; overflow: hidden; }
#top        { position:relative; float:right; width:100%; text-align:center; height: 0;}
#floater    { height:50%; margin-bottom: -300px; position:relative; width: 1px; }
#content    { clear:both; height:345px; position:relative; margin:0 auto; width:790px; padding:20px; overflow:hidden; }
0

精彩评论

暂无评论...
验证码 换一张
取 消