0
화살표 버튼을 클릭하면 다음 요소로 스크롤되지만, 임의의 요소를 아래로 스크롤하여 클릭하면 이전에 클릭 한 요소로 돌아갑니다. 클릭하지 않으면 첫 번째 요소로 이동합니다.현재 옆의 요소로 스크롤
클릭 한 요소 옆으로 스크롤하고 싶습니다. 모든 것이 버블 링되고 있습니다.
상황이 나타납니다 내가 작업 사이트, - http://dawidjarzabek.pl/test
jQuery를 :
var currentElement = $(".post");
$('.post #nav a.prev').click(function() {
currentElement = currentElement.prev();
$.scrollTo(currentElement, 800);
});
$('.post #nav a.next').click(function() {
currentElement = currentElement.next();
$.scrollTo(currentElement, 800);
});
HTML :
<div id="1" class="section">
<div class="post position">
<div id="photo"><center><img src="photos/studio/1.jpg" /></center></div>
<div id="nav"><a class="prev"><img src="images/icon_top.png" /></a><a class="next"><img src="images/icon_bottom.png" /></a></div>
<div id="text">
<h1>Modelka: </h1>
<h2></h2>
<h1>Wizaż : </h1>
<h2></h2>
</div>
</div>
<div class="post position">
<div id="photo"><center><img src="photos/studio/2.jpg" /></center></div>
<div id="nav"><a class="prev"><img src="images/icon_top.png" /></a><a class="next"><img src="images/icon_bottom.png" /></a></div>
<div id="text">
<h1>Modelka: </h1>
<h2></h2>
<h1>Wizaż : </h1>
<h2></h2>
</div>
</div>
</div>
[the rest .post and .section]
고마워요! 그것은 작동합니다! – user1601037