Skip to content

CHICPRO

  • Life Log
  • Cycling Log
  • Photo Log
    • Portrait
    • Landscape
    • Flower
    • Etc
  • Coding Log
  • Information

[jQuery] 가로 슬라이딩 연혁 표시

2012-05-03 by 편리

이런 걸 만들어 달라고 해서 간만에 jQuery 붙잡고 무한 삽질 코딩.. ㅋ 쉽게 하는 게 있을텐데.. 왜 자꾸 삽질을??

<div class=”history_navi”>
        <div class=”nav_left nav_left_dis”></div>
        <div class=”nav_right nav_right_act”></div>
    </div>
    <div class=”history_wrap”>
        <div class=”history_list”><span id=”history_image”><img src=”<?php echo $g4[company_img_path]; ?>/company_history_content2.png” alt=”” /></span></div>
    </div><!– /history_wrap –>

<script type=”text/javascript”>
var history_start = 0;
var history_end;
var hostory_position;
$(function() {
    history_end = $(‘#history_image’).width() – (270 * 2);

    $(‘.nav_left’).click(function() {
        if($(this).hasClass(“nav_left_act”)) {
            history_start += 270;
            history_end += 270;
            history_position = history_start + “px”;
            $(‘#history_image’).animate({ “margin-left”: history_position }, 1000);

            if(history_start == 0) {
                $(this).removeClass(“nav_left_act”);
                $(this).addClass(“nav_left_dis”);
            }

            if(history_end >= 270) {
                $(‘.nav_right’).removeClass(“nav_right_dis”);
                $(‘.nav_right’).addClass(“nav_right_act”);
            }
        }
    });

    $(‘.nav_right’).click(function() {
        if($(this).hasClass(“nav_right_act”)) {
            history_start -= 270;
            history_end -= 270;
            history_position = history_start + “px”;
            $(‘#history_image’).animate({ “margin-left”: history_position }, 1000);

            if(history_end < 270) {
                $(this).removeClass(“nav_right_act”);
                $(this).addClass(“nav_right_dis”);
            }

            if($(‘.nav_left’).hasClass(“nav_left_dis”)) {
                $(‘.nav_left’).removeClass(“nav_left_dis”);
                $(‘.nav_left’).addClass(“nav_left_act”);
            }
        }
    });
});
</script>

코드에서 270은 연혁이 나오는 부분의 가로가 270으로 정했기 때문이다. 근데 코드 참 거시기 하다. ㅋㅋ

Post navigation

Previous Post:

[D300] 2012.05.02 가든파이브

Next Post:

내가 홍삼을 사서 먹을 줄이야..

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recent Posts

  • php 배열 연산에서 + 와 array_merge 의 차이
  • pcntl_fork 를 이용한 다중 프로세스 실행
  • 아이폰 단축어를 이용하여 주중 공휴일엔 알람 울리지 않게 하기
  • 구글 캘린더 전체일정 재동기화
  • OpenLiteSpeed 웹서버에 HTTP 인증 적용
  • OpenLiteSpeed 웹어드민 도메인 연결
  • WireGuard를 이용한 VPN 환경 구축
  • Ubuntu 22.04 서버에 OpenLiteSpeed 웹서버 세팅
  • 맥 vim 세팅
  • 우분투 시스템 터미널쉘 zsh 로 변경

Recent Comments

  • 편리 on 업무관리용 그누보드 게시판 스킨
  • 임종섭 on 업무관리용 그누보드 게시판 스킨
  • 캐논 5D 펌웨어 | Dslr 펌웨어 업그레이드 방법 82 개의 베스트 답변 on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • Top 5 캐논 5D 펌웨어 Top 89 Best Answers on 캐논 EOS 30D 펌웨어 Ver 1.0.6 , EOS 5D 펌웨어 Ver 1.1.1
  • 편리 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 임팀장 on 워드프레스 애니메이션 gif 파일을 mp4로 변환하여 출력하기
  • 편리 on Notepad++ NppFTP 플러그인 수동 설치
  • paul-j on Notepad++ NppFTP 플러그인 수동 설치
  • YS on Windows 10 iCloud 사진 저장 폴더 변경
  • 편리 on Docker를 이용한 Centos7 + httpd + php 5.4 개발환경 구축

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2025 CHICPRO | Built using WordPress and SuperbThemes