링크 이동 문제 조언 좀 부탁드리겠습니다ㅠ

링크 이동 문제 조언 좀 부탁드리겠습니다ㅠ

QA

링크 이동 문제 조언 좀 부탁드리겠습니다ㅠ

본문

<!--         탭 메뉴         -->

<div class="liveEdtap">

<ul>

<li><a href="#1" data="1">업체</a></li>

<li><a href="#2" data="2">교육</a></li>

<li><a href="#3" data="3">신청서</a></li>

 

</ul>

</div>

 

<!--         신청서 폼         -->

<div class="liveEdtapCon" id="3">

<?php include_once(G5_BBS_PATH."/register2.php");?>

</div>

 

 

<!--        동작         -->

<script> 

$(document).ready(function(){ 

$(".liveEdtapCon").hide(); 

$(".active").show(); 

$("div.liveEdtap > ul > li > a").click(function(){ 

$(".liveEdtap > ul > li").removeClass("active"); 

$(".liveEdtapCon").removeClass("active"); 

$(this).parent().addClass("active"); 

$("#"+$(this).attr("data")).addClass("active"); 

        $(".liveEdtapCon").hide(); 

$(".active").show(); 

return false; 

}); 

}); 

</script>

 

 

이렇게 있는데 

 

해당문서 파일이 homepage.com/mypage.php 라고하면 

homepage.com/mypage.php#3 URL을 직접 입력 하면 신청서 탭에 가고싶은데 

그게안되네요 ㅠㅠ 

탭을 클릭해도 #은 안뜨고 homepage.com/mypage.php  URL만 떠요..ㅠ

조언좀 부탁드릴게요 

 

 

 

 

이 질문에 댓글 쓰기 :

답변 1

http://benalman.com/code/projects/jquery-hashchange/examples/hashchange/#test4

 

jquery hashchange event 플러그인 이용해보세요. 

js추가하고 클래스 바꿔서 진행해봤는데 ㅠ 반응이없네요..

$(function(){
 
  // Bind an event to window.onhashchange that, when the hash changes, gets the
  // hash and adds the class "selected" to any matching nav link.
  $(window).hashchange( function(){
    var hash = location.hash;
   
    // Set the page title based on the hash.
    document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'blank' ) + '.';
   
    // Iterate over all nav links, setting the "selected" class as-appropriate.
    $('#liveEdtap a').each(function(){
      var that = $(this);
      that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
    });
  })
 
  // Since the event is only triggered when the hash changes, we need to trigger
  // the event now, to handle the hash the page may have loaded with.
  $(window).hashchange();
 
});

답변을 작성하시기 전에 로그인 해주세요.
전체 59,641
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT