【发布时间】:2018-09-13 04:31:48
【问题描述】:
我想做一个函数来缩放和改变按钮的位置。当您单击时,我希望它过渡到页面的绝对中心并缩放。搞不定,菜鸟来了!谢谢!
<div id="carousel" class="carousel">
<a href="project.html" class="thumb" id="thumb">
<div class="tbTitle">
<h2>Diamonds and Pearls</h2>
<div class="vid-holder"></div>
</div>
<video src="img/01.mp4" type="video/mp4" loop muted autoplay playsinline></video>
</a>
</div>
CSS——
.thumb {
position: relative;
max-width: 640px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
margin: 3.5em;
}
.huge-thumb {
max-width: 1280px;
position: fixed;
}
jQuery –
$('#thumb').on("click", function (ev) {
ev.preventDefault();
var scale = $("#thumb").height()/($("#huge-thumb").height() * 2);
var toY = $("#thumb").offset().top - $("#huge-thumb").offset().top;
$.Velocity.animate($("#huge-thumb"), { translateY: toY, scaleX: scale, scaleY: scale, translateZ: 0 }, { delay: 1500, duration: 1050, easing: "easeInOutQuad" });
});
【问题讨论】:
-
您正在定位另一个页面来重定向浏览器。你怎么能在你离开的页面上看到动画?
标签: javascript jquery function velocity.js