2014-10-24 6 views
0

나는 버튼을 클릭 할 때마다 animate.css를 사용하여 텍스트를 확대/축소하려고합니다. 처음으로 만 작동합니다. 페이지가로드되면 처음으로 다시 작동합니다. 도움이 필요합니다.확대/축소 효과 (Animate.css)는 두 번째 클릭 또는 페이지로드없이 작동하지 않습니다.

HTML :

<div class="row contact-section"> 
    <div class="col-md-12"> 
     <h1 id='an'> contact section</h1> 
    </div> 
</div> 

<button class='.mini-contact'>animate</button> 

JQuery와 :

$('.mini-contact').on('click',function(){ 
$('.contact-section').fadeIn(); 
$('#an').addClass('animated zoomIn'); 
}) 
+0

아래 아마 JS가 필요할 것입니다. – rnevius

+0

시도한 것을 보여주는 예가 있습니까? – jbyrne2007

+0

왜 페이지로드가 아닌'$ (document) .ready'를 사용합니까? – Parody

답변

0

이보십시오 (애니메이션 재생) 클래스

을 다시 적용되지 않기 때문에이 될 것이다 :

function appyAnim(x) { 
 
    $('#animationSandbox').removeClass().addClass(x + ' animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ 
 
     $(this).removeClass(); 
 
    }); 
 
    }; 
 

 
    $(document).ready(function(){ 
 
    
 
    $('.js--triggerAnimation').click(function(e){ 
 
     e.preventDefault(); 
 
     var anim = "zoomIn"; 
 
     applyAnim(anim); 
 
    }); 
 

 
    
 
    });
<!--this be your button --> 
 
<button class="butt js--triggerAnimation">Animate</button> 
 

 
<!-- this be what you are animating --> 
 
<span id="animationSandbox" style="display: block;" class=""><h1 class="site__title mega">TEXT HERE</h1></span>
을 (.) : 여기

+0

코드 샘플을 추가해 주셔서 감사합니다. 나는 시험했다.. 그러나 어떤 운도!! .. – WahidSherief

+0

작동 ... 콘솔 확인, 일부 오류가 표시됩니까 ?? – nithin

+0

감사합니다 Bro !! 그것은 슬라이드 다른 접근 방식과 함께 작동합니다. 우르의 제안은 나를 도왔다. 감사. 여기 링크가 있습니다 http://stackoverflow.com/questions/26566532/animate-css-doesnt-work-for-second-click/26572345#26572345 – WahidSherief

0

739,내가 당신을 위해 만든 바이올린입니다 버튼 클래스 http://jsfiddle.net/4ggaof1u/

보정, 점 제거, 그것은 class='mini-contact' 을해야합니다 그리고 당신의 스크립트가 될 것 같은

$(function() { 
    $('.mini-contact').on('click', function() { 
     var $el = $('#an'), 
      c = 'zoomIn animated'; 
     $('.contact-section').fadeIn(1, function() { 
      $el.addClass(c); 
     }).delay(1000).show(0, function() { 
      $el.removeClass(c) 
     }); 
    }); 

});