2016-09-21 1 views
0

</p> 여기 <p>나는 HTML, CSS, 그리고 J 쿼리를 부착

$(document).ready(function(){ 
 

 

 
function aaa(){ 
 

 

 
$('.poss img').toggle(function() { 
 
    $(this).css({border: '2px solid white'}).animate({ 
 
     borderWidth: 2 
 
    }, 9000); 
 
},function() { 
 
    $(this).animate({ 
 
     borderWidth: 2 
 
    }, 9000); 
 
    aaa(); 
 
     
 
}); 
 

 
} 
 
aaa(); 
 

 
});
.poss{ 
 
    position: absolute; 
 
width: 100%; 
 
height: 100%; 
 
top: 90px; 
 
} 
 

 
.poss img { 
 
position: absolute; 
 
border-radius: 80px; 
 
border: 2px solid white; 
 
box-shadow: 2px 2px 14px rgba(30, 38, 74, 0.86); 
 

 
-moz-user-select: none; 
 
    -webkit-user-select: none; 
 
    -ms-user-select: none; 
 
    user-select: none; 
 
    -webkit-user-drag: none; 
 
    user-drag: none; 
 
    -webkit-touch-callout: none; 
 
}
<!DOCTYPE HTML> 
 
<html> 
 

 
<head> 
 
    <meta charset="utf-8"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <!-- comt --> 
 
    <link rel="stylesheet" type="text/css" href='/stylesheets/style.css'> 
 
    <link rel="stylesheet" href="<%= baseUrl %>/stylesheets/bootstrap.css"> 
 
    <script type="text/javascript" src="<%= baseUrl %>/javascripts/jquery-3.1.0.min.js"></script> 
 

 
    <script src="<%= baseUrl %>/javascripts/bootstrap.js"></script> 
 
    <script type="text/javascript" src="<%= baseUrl %>javascripts/appscript.js"></script> 
 

 
    <style> 
 
    .carousel-inner > .item > img, 
 
    .carousel-inner > .item > a > img { 
 
     width: 70%; 
 
     margin: auto; 
 
    } 
 
    </style> 
 

 
</head> 
 

 
<body background="<%= baseUrl %>images/back.jpg"> 
 

 
<div class="poss" style=" float: none; z-index: 1000; position: absolute; width: 20%; margin: 0 auto; left: 0px; right: 0px; " > 
 
         
 
        </div> 
 
         
 
         
 
</body> 
 

 
</html>
이 개 기능 JQuery와 사이에 전환을 느리게하는 방법에 대해 설명합니다.
여기 jquery의 두 함수 사이에서 동시에 이동하는 속도가 느려집니다. <div> 이미지는 페이지로드 후에 트리거 할 이벤트없이 애니메이션을 시작해야합니다. 또한 토글에 지연을 삽입하려고합니다.

+0

어떤 한 것은 ... –

+0

가 http://www.java2s.com/Code/JavaScript/jQuery/Toggleamongtwoormorefunctioncallseveryotherclick.htm chekc이 –

+0

가 어떻게 삽입 할 수 있습니다주십시오 코드에 대한 답을 찾을하시기 바랍니다 이 토글에 대한 지연. 나는이 두 기능이 동시 적으로 하나씩 실행되기를 바란다. –

답변

0

setTimeout(function, milliseconds) "타이밍 이벤트"를 사용하여 자바 스크립트에서 제공 할 수 있습니다.

첫 번째 매개 변수는 실행할 함수입니다.

두 번째 매개 변수는 실행 전 밀리 초 수를 나타냅니다.

예 :

$('.poss img').toggle(function() { 
    $(this).css({ 
     border: '2px solid white' 
    }).animate({ 
     borderWidth: 2 
    }, 9000); 
}, setTimeout(function() { 
    $(this).animate({ 
     borderWidth: 2 
    }, 9000); 
}, 3000)); 
관련 문제