2011-11-07 3 views
0

간단한 jquery 탭이 있는데, 이는 7 &을 제외한 모든 브라우저에서 정상적으로 작동합니다.예 : 7 & 8은 jquery가있는 탭을 숨기지 않습니다.

 <div id="tabs"> 

      <!--Menu-->   
      <ul class="grid12 first menu"> 
       <li class="grid3 first"> 
        <a href="#tab-1">ABOUT US</a> 
       </li> 
       <li class="grid3"> 
        <a href="#tab-2">FACILITIES</a> 
       </li> 
       <li class="grid3"> 
        <a href="#tab-3">SPECIALS</a> 
       </li> 
       <li class="grid3"> 
        <a href="#tab-4">CONTACT</a> 
       </li> 
      </ul> 

      <!--Content Area--> 
      <div id="tab-1"> 
       <div id="about"> 
        <div class="grid5 first"> <a href="http://www.treacyshotelwaterford.com"><img src="http://www.ingemit.com/res360/facebook/about.jpg" alt="Spirit Spa"></a></div> 

       <div class="grid7"> 
        <h1> 
         <em>Welcome to Treacys Hotel Waterford, Spa & Leisure Centre</em></h1> 
        <p> 
         <strong><span class="drop-caps">F</span>ormerly Days Hotel Waterford, Treacy's Hotel Spa & Leisure Centre is situated in the heart of Waterford City in Ireland's Sunny South-East, and is proud to be one of the finest hotels in Waterford. The hotel is the perfect choice for your business, leisure and family breaks. Guests can dine in Croker's Restaurant, enjoy a drink with friends in Timbertoes bar, relax in the swimming pool or Jacuzzi at Spirit Leisure Centre or be pampered at Spirit Beauty Spa.</strong> 
        </p> 
        <p> 
         The hotel is ideally located on the Quays in Waterford and is just a five minute walk from both the bus and train stations, and only 10km from Waterford Airport. Treacys hotel is one of the finest hotels in Waterford city centre and is a popular location for visitors who love shopping, golf, surfing, or choose from our selection of great value packages, including pampering spa breaks and activity breaks. 
        </p> 
        <p> 
         Planning your wedding? See why we are one of the best wedding hotels in Waterford. Whatever the reason come and see us and you can be assured of a warm welcome and a great time. 
        </p> 
       </div> 
       </div><!--about end--> 
      </div><!--tab1 end--> 

      <div id="tab-2"> 
       <div class="grid12 first"> 
        Facilities 
       </div> 
      </div> 

      <div id="tab-3"> 
       <div class="grid12 first"> 
        Specials 
       </div> 
      </div> 

      <div id="tab-4"> 
       <div class="grid4 first"> 
        <h2>Contact Us</h2> 
        <p><strong>Address:</strong> <span class="lightgrey">1458 Sample Road, Greenvalley, 12</span><br> 
         <strong>Telephone:</strong> <span class="lightgrey">+123-1234-5678</span><br> 
         <strong>FAX:</strong> <span class="lightgrey">+458-4578</span><br> 
         <strong>Others:</strong> <span class="lightgrey">+301 - 0125 - 01258</span><br> 
        <strong>E-mail:</strong> <span class="lightgrey">[email protected]</span></p> 
       </div> 

       <div class="grid8"> 
        <p>Map image</p> 
       </div> 
      </div> 
     </div> 
+2

우리가 당신의 HTML에 좀 걸릴 수 있습니다? – Samich

+0

당신의 HTML은 어떻게 생겼습니까? – Neal

+0

현재 탭에 URL이 포함되어 있지 않습니까? 그럼 왜 $ (currentTab) .fadeIn (400) .show(); ??? –

답변

1

href="#something"이는 그 이전에 URL 추가한다는 것입니다 볼 때 IE는 무엇을 : :이 페이지 그래서 예를 들면

을 당신이 한 경우 :

여기
 $('#tabs > div').hide(); 
     $('#tabs div:first').show(); 
     $('#tabs ul li:first').addClass('active'); 

     $('#tabs ul li a').click(function(){ 
     $('#tabs ul li').removeClass('active'); 
     $(this).parent().addClass('active'); 
     var currentTab = $(this).attr('href'); 
     $('#tabs > div').hide(); 
     $(currentTab).fadeIn(400).show(); 
     return false; 
     }); 

는 탭입니다
$('a').click(function(){ 
    alert(this.href); 
}); 

경고가 표시됩니다. http://stackoverflow.com#something

<a> 태그의 다른 부분을 활용하여 정의를 수행하면됩니다. 과 같이 태그를 포맷하십시오 :

  <li class="grid3"> 
       <a href="#tab-4" data-link="tab-4">CONTACT</a> 
      </li> 

그런 다음 코드에서 당신이 할 수 있습니다

var currentTab = "#"+$(this).data('link'); 
관련 문제