1
같은 버튼을 두 번 이상 누르면 다음 슬라이드 효과가 적용됩니다. 의미, 빨간 버튼을 선택하여 색상을 표시하고 빨간색을 다시 누르면 해당 색상을 숨 깁니다. 세 번째로 누르면 누를 수 없습니다. 빨간색이 다시 작동하려면 다른 색상을 선택해야합니다. 이것은 모든 버튼에서 발생합니다. 어떻게 그만합니까? fiddle demo연속 버튼을 누를 때 버튼이 작동하지 않습니다.
// When the DOM is ready, initialize the scripts.
jQuery(function($){
// Get a reference to the container.
var container = $(".container");
// Bind the link to toggle the slide.
$("a").click(function(event){
// Prevent the default event.
event.preventDefault();
var $this = $(this);
var $target = $("#target");
if ($target.attr("class") === $this.attr("data-color")) {
container.slideUp(500);
} else {
// Hide - slide up.
container.slideUp(500, function(){
$target.attr("class", $this.attr("data-color"));
// Show - slide down.
container.slideDown(500);
});
}
});
});
가 너무 좋은, 감사합니다! – need2nobasis