Q&A

CMS/프레임워크 XE 1.x
개발 언어 사용안함

<script>
jQuery(function($){
    var divX = $(".img_borad .box_2").offset().left;

    $(".img_borad .button .next").click(function(){
            $(".img_borad .box_2").css("left","-=340px")
    });

    $(".img_borad .button .prew").click(function(){
            $(".img_borad .box_2").css("left","+=340px")
    });
});
</script>

이런식으로 클릭이벤트는 만들긴했는데

누르면 누르는대로 계속 변경되기에.. 

현재 위치값에 따라서 반응하도록 변경하고싶습니다. ㅜ.ㅜ

mospia Lv. 4

댓글 1

  • 2018.12.20 00:57 #1131481
    <script>
    jQuery(function($){
    var count=0;
    $(".img_borad .button .next").click(function(){
    if(count>=0 && count < 3){
    $(".img_borad .box_2").css("left","-=340px")
    count++;
    };
    });
    $(".img_borad .button .prew").click(function(){
    if(count>0){
    $(".img_borad .box_2").css("left","+=340px")
    count--;
    }
    });
    });
    </script>
    count값으로 클릭횟수지정해서 해결했습니다