2016-10-12 4 views
3

Malihu의 맞춤 스크롤바 플러그인을 사용하고 있으며이 플러그인과 함께 'Scroll to id'플러그인을 추가하려고합니다. 내 스 니펫에 제공된 코드는 내가 원하는 방식으로 작동합니다 (버튼이 작동하지 않는 경우도 있음).Malihu 사용자 정의 스크롤바 - 페이지에서 작동하지 않는 id 플러그인으로 스크롤

중요한 문제는 내가이 코드를 내 사이트에 넣어서 작동하지 못하게하는 것입니다. 페이지를 아래로 스크롤하면 올바른 부분이 올바른 점으로 강조 표시되지만 점을 클릭하면 오른쪽 섹션으로 이동하지 않고 아무 것도 수행하지 않습니다.

페이지 : 귀하의 버튼의 가끔 행동 당신의 조각에 관해서는 https://www.kentunion.co.uk/test2/

$(document).ready(function() { 
 
    (function($){ 
 
    $(window).on("load",function(){ 
 
     $("a[href*='#']").mPageScroll2id(); 
 
    }); 
 
    })(jQuery); 
 
});
#background { 
 
    background-image: url("/pageassets/test2/background.jpg"); 
 
    position: fixed; 
 
    background-color: #E07853; 
 
    width: 100%; 
 
    height: 100%; 
 
    top: 0; 
 
    background-size: cover; 
 

 
} 
 
.content-spacing { 
 
    padding: 0px !important; 
 
} 
 
#background div { 
 
    position: absolute; 
 
    height: 100%; 
 
    width: 100%; 
 
    top: 0; 
 
    background-color: #ffffff; 
 
    -khtml-opacity: .1; 
 
    -moz-opacity: .1; 
 
    opacity: .1; 
 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)"; 
 
} 
 
a{ 
 
    color: inherit; 
 
    text-decoration: none; 
 
    -webkit-transition: all .3s ease-in-out; -moz-transition: all .3s ease-in-out; -o-transition: all .3s ease-in-out; transition: all .3s ease-in-out; 
 
} 
 

 
hr{ 
 
    display: block; 
 
    height: 0; 
 
    border: 0; 
 
    border-top: 1px solid rgba(0,0,0,0.2); 
 
    border-bottom: 1px solid rgba(255,255,255,0.2); 
 
    margin: 1em 0; 
 
    padding:0; 
 
} 
 

 
h1, h2, h3, p{ 
 
    margin-bottom: 1em; 
 
} 
 

 
h1, h2{ 
 
    font-family: 'Lobster Two',georgia,serif; 
 
    line-height: 1em; 
 
    font-weight: 700; 
 
} 
 

 
h2{ 
 
    font-size: 4em; 
 
} 
 

 
#navigation-menu { 
 
    position: fixed; 
 
    right: 40px; 
 
    top: 50%; 
 
    bottom: auto; 
 
    -webkit-transform: translateY(-50%); 
 
    -moz-transform: translateY(-50%); 
 
    -ms-transform: translateY(-50%); 
 
    -o-transform: translateY(-50%); 
 
    transform: translateY(-50%); 
 
    z-index: 9; 
 
} 
 
header, #content, footer{ 
 
    position: relative; 
 
} 
 

 
header, footer{ 
 
    padding: 1em 3em; 
 
    text-shadow: none; 
 
} 
 

 
header h1{ 
 
    color: #e6842c; 
 
    font-size: 1.4em; 
 
    font-style: italic; 
 
} 
 

 
nav ul, nav ol, nav li{ 
 
    list-style: none; 
 
    margin: 0; 
 
    padding: 0; 
 
} 
 
#navigation-menu ul{ 
 
    overflow: hidden; 
 
    background: #564a44; 
 
    background: rgba(0,0,0,0.5); 
 
    -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; 
 
} 
 

 
#navigation-menu li{ 
 
    margin: 3px; 
 
} 
 

 
#navigation-menu a{ 
 
    display: block; 
 
    padding: 0.2em 0.6em; 
 
    border-radius: 50%; 
 
    height: 30px; 
 
    border: 1px solid black; 
 
} 
 

 
#navigation-menu a:hover, #navigation-menu a.mPS2id-highlight{ 
 
    background: #e6842c; 
 
    color: #fff; 
 
} 
 

 
.content { 
 
    z-index: 500; 
 
    display: block; 
 
    position: relative; 
 
} 
 

 
#contents section{ 
 
    text-align: center; 
 
    min-height: 900px; 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.6),inset 0 1px 0 rgba(255,255,255,0.3); box-shadow: 0 -1px 0 rgba(0,0,0,0.6),inset 0 1px 0 rgba(255,255,255,0.3); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b5f59', endColorstr='#362f2d',GradientType=1); 
 
    color: #d9d6d5; 
 
} 
 

 
#contents section:nth-child(3n+2){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efe7dc', endColorstr='#c6b6a4',GradientType=1); 
 
    color: #25201e; 
 
} 
 

 
#contents section:nth-child(3n+3){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d6fbfc', endColorstr='#94cbce',GradientType=1); 
 
    color: #25201e; 
 
} 
 

 
.contents{ 
 
    padding: 1em 3em; 
 
    z-index: 500; 
 
    display: block; 
 
    position: relative; 
 
} 
 

 
.contents hr + a, .content hr + a + a{ 
 
    margin-right: 2em; 
 
} 
 

 
.mPS2id-target .content h2:first-child:after{ 
 
    display: inline-block; 
 
    position: relative; 
 
    vertical-align: middle; 
 
    margin-left: 1em; 
 
    font-size: 0.25em; 
 
    line-height: 1.4em; 
 
    font-style: italic; 
 
    opacity: 0.7; 
 
    width: 180px; 
 
    font-family: arial,sans-serif; 
 
    font-weight: normal; 
 
} 
 

 
.ie8 .mPS2id-target .content h2:first-child:after{ 
 
    font-size: 0.95em; 
 
} 
 

 
header, .content, footer{ 
 
    padding-right: 150px; 
 
} 
 

 
.horizontal-layout{ 
 
    width: 700%; 
 
} 
 

 
.horizontal-layout header h1{ 
 
    display: none; 
 
} 
 

 
.horizontal-layout #navigation-menu{ 
 
    right: auto; 
 
    left: 3em; 
 
    top: 4em; 
 
} 
 

 
.horizontal-layout #contents{ 
 
    overflow: hidden; 
 
} 
 

 
.horizontal-layout #contents section{ 
 
    width: 14.285%; 
 
    float: left; 
 
    min-height: 480px; 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.6); 
 
    box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.6); 
 
} 
 

 
.horizontal-layout #content section:nth-child(3n+2),.horizontal-layout #content section:nth-child(3n+3){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.2),inset 1px 0 0 rgba(255,255,255,0.5); 
 
    box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.2),inset 1px 0 0 rgba(255,255,255,0.5); 
 
} 
 

 
.horizontal-layout .content h2{ 
 
    position: relative; 
 
    padding-bottom: 50px; 
 
} 
 

 
.horizontal-layout .content h2 + p{ 
 
    margin-top: -50px; 
 
} 
 

 
.horizontal-layout .mPS2id-target .content h2:first-child:after{ 
 
    display: block; 
 
    position: absolute; 
 
    width: 100%; 
 
    height: 50px; 
 
    margin-left: 0; 
 
} 
 

 
.horizontal-layout header > *, .horizontal-layout footer > *{ 
 
    width: 10%; 
 
} 
 

 
.horizontal-layout header, .horizontal-layout .content, .horizontal-layout footer{ 
 
    padding-left: 150px; 
 
    padding-right: 3em; 
 
} 
 

 
.auto-layout{ 
 
    width: 6200px; 
 
    height: 6200px; 
 
} 
 

 
.auto-layout header h1{ 
 
    margin-left: 150px; 
 
} 
 

 
.auto-layout #navigation-menu{ 
 
    right: auto; 
 
    left: 2em; 
 
} 
 

 
.auto-layout #contents{ 
 
    height: 100%; 
 
} 
 

 
.auto-layout #contents section{ 
 
    position: absolute; 
 
    min-height: 600px; 
 
    width: 600px; 
 
    top: 0; 
 
    left: 0; 
 
    margin-left: 3em; 
 
    -webkit-box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2); 
 
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2); 
 
    -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; 
 
} 
 

 
.auto-layout #contents section#section-2{ 
 
    top: 0; 
 
    left: 1800px; 
 
} 
 

 
.auto-layout #contents section#section-3{ 
 
    top: 1200px; 
 
    left: 900px; 
 
} 
 

 
.auto-layout #contents section#section-4{ 
 
    top: 1200px; 
 
    left: 2700px; 
 
} 
 

 
.auto-layout #contents section#section-5{ 
 
    top: 2400px; 
 
    left: 1800px; 
 
} 
 

 
.auto-layout #contents section#section-6{ 
 
    top: 2400px; 
 
    left: 3600px; 
 
} 
 

 
.auto-layout #contents section#section-7{ 
 
    top: 3600px; 
 
    left: 2700px; 
 
} 
 

 
.auto-layout .contents{ 
 
    padding-left: 150px; 
 
    padding-right: 3em; 
 
} 
 

 
@media only screen and (min-width: 1140px){ 
 

 
    header, .contents, footer, 
 
    .horizontal-layout header, .horizontal-layout .contents, .horizontal-layout footer, 
 
    .auto-layout .contents{ 
 
    padding-right: 3em; 
 
    padding-left: 3em; 
 
    } 
 

 
    .horizontal-layout header h1{ 
 
    display: block; 
 
    } 
 

 
    .auto-layout header h1{ 
 
    margin-left: 0; 
 
    } 
 

 
    #navigation-menu{ 
 
    font-size: 1em; 
 
    } 
 

 
    .horizontal-layout #navigation-menu, .auto-layout #navigation-menu{ 
 
    right: 3em; 
 
    left: auto; 
 
    top: 1.55em; 
 
    } 
 

 
    #navigation-menu ul{ 
 
    -moz-border-radius: 17px; -webkit-border-radius: 17px; border-radius: 17px; 
 
    } 
 

 
    #navigation-menu li{ 
 
    float: left; 
 
    margin: 3px 5px; 
 
    } 
 

 

 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="https://www.kentunion.co.uk/assets/site_resources/jquery.malihu.PageScroll2id.min.js"></script> 
 
<nav id="navigation-menu"> 
 
    <ul> 
 
    <li><a href="#section-1"></a></li> 
 
    <li><a href="#section-2"></a></li> 
 
    <li><a href="#section-3"></a></li> 
 
    <li><a href="#section-4"></a></li> 
 
    <li><a href="#section-5"></a></li> 
 
    <li><a href="#section-6"></a></li> 
 
    <li><a href="#section-7"></a></li> 
 
    <li><a href="#section-8"></a></li> 
 
    <li><a href="#section-9"></a></li> 
 
    <li><a href="#section-10"></a></li> 
 
    <li><a href="#section-11"></a></li> 
 
    <li><a href="#section-12"></a></li> 
 
    </ul> 
 
</nav> 
 

 
<div id="contents"> 
 
    <section id="section-1"> 
 
    <div class="contents"> 
 
     <p>Our three year strategic plan ends in 2017 so we are busy writing our new one. Kent Union's plan outlines the priorities for our organisation and what we will be working on. It's really important that we get your input into our plan for 2017 - 2020. We are your students' union and improving your student experience here at the University of Kent is what we are here to do.</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-2"> 
 
    <div class="content"> 
 
     <h2>There are lots of different ways you can get involved in developing our new plan.</h2> 
 
     <ul> 
 
     <li>Take our survey to tell us how you feel about life at Kent and what you want us to work on</li> 
 
     <li>Send us your feedback, on anything you think we need to know</li> 
 
     <li>Sign up to take part in a focus group or interview</li> 
 
     </ul> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-3"> 
 
    <div class="content"> 
 
     <p>How we're developing our new plan. We'll keep this section updated, so you can see our progress and what we've found out. </p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-4"> 
 
    <div class="content"> 
 
     <h2>Stage 1</h2> 
 
     <p>Desk based research to understand all the issues that might affect you. You can read our full report here, or for those of you without an hour to spare we've done a one page version</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-5"> 
 
    <div class="content"> 
 
     <h2>Stage 2</h2> 
 
     <p>Interviews with senior university staff</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-6"> 
 
    <div class="content"> 
 
     <h2>Stage 3</h2> 
 
     <p>Large scale survey with all our members</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-7"> 
 
    <div class="content"> 
 
     <h2>Stage 4</h2> 
 
     <p>Focus groups and interviews with some of you</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-8"> 
 
    <div class="content"> 
 
     <h2>Stage 5</h2> 
 
     <p>Focus groups with secondary school and FE students, to understand their perspectives of studying at University </p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-9"> 
 
    <div class="content"> 
 
     <h2>Stage 6</h2> 
 
     <p>Presenting our draft plan at AGM in November for your feedback</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-10"> 
 
    <div class="content"> 
 
     <h2>Stage 7</h2> 
 
     <p>Presenting our plan to the University of Kent's management team in December</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-11"> 
 
    <div class="content"> 
 
     <h2>Stage 8</h2> 
 
     <p>Signing off our plan at our Board of Trustees in March</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-12"> 
 
    <div class="content"> 
 
     <h2>Stage 9</h2> 
 
     <p>Launch of new Kent Union's plan in September 2017</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
</div> 
 
<div id="background"><div></div></div>

답변

0

메뉴 리튬이보다 낮은 (또한 귀하의 사이트에)는 CSS Z-인덱스 때문이다 많은 경우 마우스 클릭이 버튼에 도달하지 못하게하는 콘텐츠입니다.

귀하의 사이트에서 알 수있는 한 link.click(function(){ 코드는 링크 기능을 사용 중지하여 mPageScroll2id이 그 일을하지 못하게합니다. 특히 return false; 줄을 다시 사용하도록 설정 했으므로 사이트에서도 사용할 수 있습니다.

귀하의 mPageScroll2id과 동일한 역할을 수행하는 것으로 보이므로 $("ul li a").each(function(){ 코드 내의 전체 섹션이 필요하지 않은 것처럼 보이므로 귀하의 사이트에서이 태그를 완전히 테스트하지 않은 채로 테스트 한 다음 여전히 필요하다면 반환 거짓 라인을 주석 처리합니다.

// container ref 
 
    var sections = $('section'); 
 

 
    $("ul li a").each(function(){ 
 

 
     // link ref 
 
     var link = $(this); 
 
     // section ref 
 
     var section = $(link.attr('href')); 
 

 
     // disable link 
 

 
     link.click(function(){ 
 

 
      sections.mCustomScrollbar("scrollTo", section.position().top, { 
 
\t \t \t  timeout:0, 
 
       scrollInertia:2000, 
 
\t \t \t }); 
 

 
      // disable original jumping 
 
      // return false; 
 
     }); 
 
    }); 
 

 
$(document).ready(function() { 
 
(function($){ 
 
    $(window).on("load",function(){ 
 
     $("a[href*='#']").mPageScroll2id(); 
 
    }); 
 
})(jQuery); 
 

 
$("#navigation a").mPageScroll2id({ 
 
    scrollSpeed:900 
 
}); 
 
});
#background { 
 
    background-image: url("/pageassets/test2/background.jpg"); 
 
    position: fixed; 
 
    background-color: #E07853; 
 
    width: 100%; 
 
    height: 100%; 
 
    top: 0; 
 
    background-size: cover; 
 

 
} 
 
.content-spacing { 
 
    padding: 0px !important; 
 
} 
 
#background div { 
 
    position: absolute; 
 
    height: 100%; 
 
    width: 100%; 
 
    top: 0; 
 
    background-color: #ffffff; 
 
    -khtml-opacity: .1; 
 
    -moz-opacity: .1; 
 
    opacity: .1; 
 
    -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=10)"; 
 
} 
 
a{ 
 
    color: inherit; 
 
    text-decoration: none; 
 
    -webkit-transition: all .3s ease-in-out; -moz-transition: all .3s ease-in-out; -o-transition: all .3s ease-in-out; transition: all .3s ease-in-out; 
 
} 
 

 
hr{ 
 
    display: block; 
 
    height: 0; 
 
    border: 0; 
 
    border-top: 1px solid rgba(0,0,0,0.2); 
 
    border-bottom: 1px solid rgba(255,255,255,0.2); 
 
    margin: 1em 0; 
 
    padding:0; 
 
} 
 

 
h1, h2, h3, p{ 
 
    margin-bottom: 1em; 
 
} 
 

 
h1, h2{ 
 
    font-family: 'Lobster Two',georgia,serif; 
 
    line-height: 1em; 
 
    font-weight: 700; 
 
} 
 

 
h2{ 
 
    font-size: 4em; 
 
} 
 

 
#navigation-menu { 
 
    position: fixed; 
 
    right: 40px; 
 
    top: 50%; 
 
    bottom: auto; 
 
    -webkit-transform: translateY(-50%); 
 
    -moz-transform: translateY(-50%); 
 
    -ms-transform: translateY(-50%); 
 
    -o-transform: translateY(-50%); 
 
    transform: translateY(-50%); 
 
    z-index: 9; 
 
} 
 
header, #content, footer{ 
 
    position: relative; 
 
} 
 

 
header, footer{ 
 
    padding: 1em 3em; 
 
    text-shadow: none; 
 
} 
 

 
header h1{ 
 
    color: #e6842c; 
 
    font-size: 1.4em; 
 
    font-style: italic; 
 
} 
 

 
nav ul, nav ol, nav li{ 
 
    list-style: none; 
 
    margin: 0; 
 
    padding: 0; 
 
} 
 
#navigation-menu ul{ 
 
    overflow: hidden; 
 
    background: #564a44; 
 
    background: rgba(0,0,0,0.5); 
 
    -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; 
 
} 
 

 
#navigation-menu li{ 
 
    margin: 3px; 
 
} 
 

 
#navigation-menu a{ 
 
    display: block; 
 
    padding: 0.2em 0.6em; 
 
    border-radius: 50%; 
 
    height: 30px; 
 
    border: 1px solid black; 
 
    z-index: 550; 
 
} 
 

 
#navigation-menu a:hover, #navigation-menu a.mPS2id-highlight{ 
 
    background: #e6842c; 
 
    color: #fff; 
 
} 
 

 
.content { 
 
    z-index: 5; 
 
    display: block; 
 
    position: relative; 
 
} 
 

 
#contents section{ 
 
    text-align: center; 
 
    min-height: 900px; 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.6),inset 0 1px 0 rgba(255,255,255,0.3); box-shadow: 0 -1px 0 rgba(0,0,0,0.6),inset 0 1px 0 rgba(255,255,255,0.3); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#6b5f59', endColorstr='#362f2d',GradientType=1); 
 
    color: #d9d6d5; 
 
} 
 

 
#contents section:nth-child(3n+2){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#efe7dc', endColorstr='#c6b6a4',GradientType=1); 
 
    color: #25201e; 
 
} 
 

 
#contents section:nth-child(3n+3){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); box-shadow: 0 -1px 0 rgba(0,0,0,0.2),inset 0 1px 0 rgba(255,255,255,0.5); 
 
    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d6fbfc', endColorstr='#94cbce',GradientType=1); 
 
    color: #25201e; 
 
} 
 

 
.contents{ 
 
    padding: 1em 3em; 
 
    z-index: 5; 
 
    display: block; 
 
    position: relative; 
 
} 
 

 
.contents hr + a, .content hr + a + a{ 
 
    margin-right: 2em; 
 
} 
 

 
.mPS2id-target .content h2:first-child:after{ 
 
    display: inline-block; 
 
    position: relative; 
 
    vertical-align: middle; 
 
    margin-left: 1em; 
 
    font-size: 0.25em; 
 
    line-height: 1.4em; 
 
    font-style: italic; 
 
    opacity: 0.7; 
 
    width: 180px; 
 
    font-family: arial,sans-serif; 
 
    font-weight: normal; 
 
} 
 

 
.ie8 .mPS2id-target .content h2:first-child:after{ 
 
    font-size: 0.95em; 
 
} 
 

 
header, .content, footer{ 
 
    padding-right: 150px; 
 
} 
 

 
.horizontal-layout{ 
 
    width: 700%; 
 
} 
 

 
.horizontal-layout header h1{ 
 
    display: none; 
 
} 
 

 
.horizontal-layout #navigation-menu{ 
 
    right: auto; 
 
    left: 3em; 
 
    top: 4em; 
 
} 
 

 
.horizontal-layout #contents{ 
 
    overflow: hidden; 
 
} 
 

 
.horizontal-layout #contents section{ 
 
    width: 14.285%; 
 
    float: left; 
 
    min-height: 480px; 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.6); 
 
    box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.6); 
 
} 
 

 
.horizontal-layout #content section:nth-child(3n+2),.horizontal-layout #content section:nth-child(3n+3){ 
 
    -webkit-box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.2),inset 1px 0 0 rgba(255,255,255,0.5); 
 
    box-shadow: 0 -1px 0 rgba(0,0,0,0.3),inset 0 1px 0 rgba(255,255,255,0.3),-1px 0 0 rgba(0,0,0,0.2),inset 1px 0 0 rgba(255,255,255,0.5); 
 
} 
 

 
.horizontal-layout .content h2{ 
 
    position: relative; 
 
    padding-bottom: 50px; 
 
} 
 

 
.horizontal-layout .content h2 + p{ 
 
    margin-top: -50px; 
 
} 
 

 
.horizontal-layout .mPS2id-target .content h2:first-child:after{ 
 
    display: block; 
 
    position: absolute; 
 
    width: 100%; 
 
    height: 50px; 
 
    margin-left: 0; 
 
} 
 

 
.horizontal-layout header > *, .horizontal-layout footer > *{ 
 
    width: 10%; 
 
} 
 

 
.horizontal-layout header, .horizontal-layout .content, .horizontal-layout footer{ 
 
    padding-left: 150px; 
 
    padding-right: 3em; 
 
} 
 

 
.auto-layout{ 
 
    width: 6200px; 
 
    height: 6200px; 
 
} 
 

 
.auto-layout header h1{ 
 
    margin-left: 150px; 
 
} 
 

 
.auto-layout #navigation-menu{ 
 
    right: auto; 
 
    left: 2em; 
 
} 
 

 
.auto-layout #contents{ 
 
    height: 100%; 
 
} 
 

 
.auto-layout #contents section{ 
 
    position: absolute; 
 
    min-height: 600px; 
 
    width: 600px; 
 
    top: 0; 
 
    left: 0; 
 
    margin-left: 3em; 
 
    -webkit-box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2); 
 
    box-shadow: inset 1px 1px 0 rgba(255,255,255,0.2); 
 
    -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; 
 
} 
 

 
.auto-layout #contents section#section-2{ 
 
    top: 0; 
 
    left: 1800px; 
 
} 
 

 
.auto-layout #contents section#section-3{ 
 
    top: 1200px; 
 
    left: 900px; 
 
} 
 

 
.auto-layout #contents section#section-4{ 
 
    top: 1200px; 
 
    left: 2700px; 
 
} 
 

 
.auto-layout #contents section#section-5{ 
 
    top: 2400px; 
 
    left: 1800px; 
 
} 
 

 
.auto-layout #contents section#section-6{ 
 
    top: 2400px; 
 
    left: 3600px; 
 
} 
 

 
.auto-layout #contents section#section-7{ 
 
    top: 3600px; 
 
    left: 2700px; 
 
} 
 

 
.auto-layout .contents{ 
 
    padding-left: 150px; 
 
    padding-right: 3em; 
 
} 
 

 
@media only screen and (min-width: 1140px){ 
 

 
    header, .contents, footer, 
 
    .horizontal-layout header, .horizontal-layout .contents, .horizontal-layout footer, 
 
    .auto-layout .contents{ 
 
    padding-right: 3em; 
 
    padding-left: 3em; 
 
    } 
 

 
    .horizontal-layout header h1{ 
 
    display: block; 
 
    } 
 

 
    .auto-layout header h1{ 
 
    margin-left: 0; 
 
    } 
 

 
    #navigation-menu{ 
 
    font-size: 1em; 
 
    } 
 

 
    .horizontal-layout #navigation-menu, .auto-layout #navigation-menu{ 
 
    right: 3em; 
 
    left: auto; 
 
    top: 1.55em; 
 
    } 
 

 
    #navigation-menu ul{ 
 
    -moz-border-radius: 17px; -webkit-border-radius: 17px; border-radius: 17px; 
 
    } 
 

 
    #navigation-menu li{ 
 
    float: left; 
 
    margin: 3px 5px; 
 
    } 
 

 

 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<script src="http://manos.malihu.gr/repository/custom-scrollbar/demo/jquery.mCustomScrollbar.concat.min.js"></script> 
 
<script src="https://www.kentunion.co.uk/assets/site_resources/jquery.malihu.PageScroll2id.min.js"></script> 
 
<nav id="navigation-menu"> 
 
    <ul> 
 
    <li><a href="#section-1" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-2" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-3" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-4" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-5" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-6" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-7" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-8" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-9" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-10" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-11" rel="m_PageScroll2id"></a></li> 
 
    <li><a href="#section-12" rel="m_PageScroll2id"></a></li> 
 
    </ul> 
 
</nav> 
 

 
<div id="contents"> 
 
    <section id="section-1"> 
 
    <div class="contents"> 
 
     <p>Our three year strategic plan ends in 2017 so we are busy writing our new one. Kent Union's plan outlines the priorities for our organisation and what we will be working on. It's really important that we get your input into our plan for 2017 - 2020. We are your students' union and improving your student experience here at the University of Kent is what we are here to do.</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-2" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-2"> 
 
    <div class="content"> 
 
     <h2>There are lots of different ways you can get involved in developing our new plan.</h2> 
 
     <ul> 
 
     <li>Take our survey to tell us how you feel about life at Kent and what you want us to work on</li> 
 
     <li>Send us your feedback, on anything you think we need to know</li> 
 
     <li>Sign up to take part in a focus group or interview</li> 
 
     </ul> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-3" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-3"> 
 
    <div class="content"> 
 
     <p>How we're developing our new plan. We'll keep this section updated, so you can see our progress and what we've found out. </p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-4" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-4"> 
 
    <div class="content"> 
 
     <h2>Stage 1</h2> 
 
     <p>Desk based research to understand all the issues that might affect you. You can read our full report here, or for those of you without an hour to spare we've done a one page version</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-5" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-5"> 
 
    <div class="content"> 
 
     <h2>Stage 2</h2> 
 
     <p>Interviews with senior university staff</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-6" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-6"> 
 
    <div class="content"> 
 
     <h2>Stage 3</h2> 
 
     <p>Large scale survey with all our members</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> <a href="#section-7" rel="next">&darr; Next section</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-7"> 
 
    <div class="content"> 
 
     <h2>Stage 4</h2> 
 
     <p>Focus groups and interviews with some of you</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-8"> 
 
    <div class="content"> 
 
     <h2>Stage 5</h2> 
 
     <p>Focus groups with secondary school and FE students, to understand their perspectives of studying at University </p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-9"> 
 
    <div class="content"> 
 
     <h2>Stage 6</h2> 
 
     <p>Presenting our draft plan at AGM in November for your feedback</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-10"> 
 
    <div class="content"> 
 
     <h2>Stage 7</h2> 
 
     <p>Presenting our plan to the University of Kent's management team in December</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-11"> 
 
    <div class="content"> 
 
     <h2>Stage 8</h2> 
 
     <p>Signing off our plan at our Board of Trustees in March</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
    <section id="section-12"> 
 
    <div class="content"> 
 
     <h2>Stage 9</h2> 
 
     <p>Launch of new Kent Union's plan in September 2017</p> 
 
     <hr /><a href="#top">&uarr; Back to top</a> 
 
    </div> 
 
    </section> 
 
</div> 
 
<div id="background"><div></div></div>

0

나는 당신의 페이지 디자인에서 일반적인 문제가 있다고 생각하고 scrollTop가 어떻게 작동하는지. 일반적으로 scrollTop은 창 크기와 겹치는 dom 요소에 사용하기위한 것입니다. 스크롤 이벤트를 바인드하는 사용자 정의 스크롤바를 사용하고 스크롤을 시뮬레이트하기 위해 CSS 속성을 top으로 업데이트합니다. 기본적으로는 더 큰 문서를 통해 뷰포트를 움직이는 :

<div id="mCSB_2_container" 
    class="mCSB_container" 
    style="position: relative; top: -10px; left: 0px;" <------ 
    dir="ltr">[Viewport] 
</div> 

당신이 뷰포트 내에서 상대적 위치를 계산하고 컨테이너의 top 속성을 조작하는 함수를 직접 구현해야 사용자 정의 스크롤에 충실합니다.