나는 .about-us와 .price-list라는 두 개의 섹션을 가지고있다. 그것들을 활성화시키는 2 개의 버튼 .prices와 .about-us-btn. 두 섹션은 기본적으로 JQuery와 함께 숨겨져 있으며 각각에 대해 .slideToggle 이벤트가 있습니다. 하나라도 표시되면 다른 버튼을 클릭하면 슬라이드됩니다.JQuery - 슬라이딩 업 대신 페이드 아웃하는 방법?
이제 슬라이딩 백업 대신 fadeOut 이벤트를 수행 할 수 있습니다. 작동하지만, .price-list가 먼저 보이면 .prices를 클릭하십시오. (두 섹션은 같은 위치에 있지만 버튼을 클릭하면 하나만 보입니다). .about-us가 먼저 표시되면 .prices 버튼을 클릭하면 .about-us가 페이드 아웃 대신 슬라이드 업됩니다.
어쨌든. 희망을 이해하고 나를 도울 수 있습니다!. Heres 내 JQuery 코드 :
$(document).ready(function(e){
// Price-list & About-us are hidden by Javascript
$("aside.price-list, aside.about-us").hide();
// Create a slide for the price-list
$("button.prices").click(function(){
$("aside.about-us").fadeOut(300);
$("aside.price-list").slideToggle(300);
});
// Create a slide for the about-us
$("button.about-btn").click(function(e){
$("aside.about-us").slideToggle(300);
$("aside.price-list").fadeOut(300);
});
});