일부 div 블록이 있습니다. 나는 그것의 크기를 조절하는 데 필요하다. MacOS 도킹 패널에서와 마찬가지로, 아이콘이 맴돌 때. 내가 할 수 있을까?JQuery/Javascript 블록 스케일링
1
A
답변
5
예 수행 할 수 있습니다
HTML :
<div class="scaleMe"> </div>
jQuery를 : : 여기
$(function(){ /* makes sure your dom is ready */
$('div.scaleMe').hover(function(){
$(this).stop(false, true).animate({width:'50px', height:'50px'}, 1000) /* makes the div big on hover, and .stop() makes sure the annimation is not looping*/
},function(){
$(this).stop(false, true).animate({width:'20px', height:'20px'}, 600) /* goes back to normal state */
})
})
당신이 jQuery를 함께 만든 독 같은 OSX의 좋은 예를 찾을 수 있습니다 http://www.ndesign-studio.com/blog/css-dock-menu
+0
이 메뉴는 다음과 같습니다. 굉장해! –
1
어쩌면 이렇게 될까요?
$("#myDiv").hover(
function(){
$(this).css({height : scaled_height, width : scaled_width});
},
function(){
$(this).css({height : original_height, width : original_width});
}
);
0
나는이 해결책을 http://jsbin.com/ecuzof/1/edit/에서 얻었다. 승인은 작성자에게갑니다. http://forum.jquery.com/topic/i-want-to-resize-or-scale-the-div-on-hover에서 링크를 찾았습니다.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Zoom DIV on Hover</title>
<link href="http://code.jquery.com/ui/1.8.21/themes/base/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.8.21/jquery-ui.min.js"></script>
<style>
body{
font-size:162.5%;
}
</style>
<style>
.sectionToZoomOnHover {
display: table-cell;
text-align: center;
vertical-align: middle;
width: 200px;
height: 50px;
margin: 1em;
padding: 1.2em;
border: 1px solid gray;
background: yellow;
}
</style>
</head>
<body>
<div class="sectionToZoomOnHover">
Hover me. I'll grow
</div>
<script>
$(".sectionToZoomOnHover").hover(
function() {
$(this).stop().animate(
{
width: 360,
height: 100,
backgroundColor: "lightBlue",
fontSize: "3em"
}
);
}, function() {
$(this).stop().animate(
{
width: 200,
height: 50,
backgroundColor: "yellow",
fontSize: "1em"
}
);
}
);
</script>
</body>
</html>
불행하게도, 나는 확대하는 방법을 생각하지 않은 그래서 DIV의 중심점은 정말 너무하고 싶은 효과가있는 그대로 남아있다.
관련 문제
- 1. 토폴로지, 스케일링
- 2. 스케일링 비용 레일과 스케일링 비용 PHP 대 파이썬 프레임 워크
- 3. 스케일링 방정식 - 플래시
- 4. 스케일링 WinForms TableLayoutPanel
- 5. 안드로이드에서 YUV 프레임 스케일링
- 6. 안드로이드와 비트 맵 스케일링
- 7. 자바 이미지 스케일링
- 8. C#의 다차원 스케일링
- 9. 안드로이드에서 이미지 스케일링
- 10. UIImageView 회전 후 스케일링
- 11. XNA 윈도우 스케일링 성능
- 12. Android에서 SVG 스케일링?
- 13. opengl에서 고정 된 스케일링
- 14. 스케일링 웹 프론트 엔드
- 15. 다각형을 가장자리쪽으로 스케일링 하시겠습니까?
- 16. 소켓 서버 스케일링
- 17. 최소 제곱 최적 스케일링
- 18. 안드로이드 브라우저 스케일링?
- 19. WPF 스케일링 문제
- 20. 캔버스와 요소를 함께 스케일링
- 21. 스케일링 확대 이미지 문제
- 22. 플래시의 타임 스케일링 동영상
- 23. CUFFT의 스케일링 팩터
- 24. 간단한 CATextLayer 스케일링 문제
- 25. 파이 게임에서의 스케일링 문제
- 26. 고득점 데이터베이스 스케일링
- 27. 동적 이미지 스케일링
- 28. Java2D : 스케일링 문제
- 29. 레일스 : 그룹 계산으로 스케일링
- 30. MATLAB의 스케일링 변경
자바 스크립트! = javascript – balexandre
그래, 놓쳤다. 감사. – Ockonal