当我的height被滚动到视图中时,如何自动和频繁地更改width和div?
<div id="contact" class="fadeInBlock">
<div class="map">
<div class="pointer">
<div class="dot"></div>
</div>
<div class="address">
<address></address>
</div>
</div>
</div>(将要改变div height和width的是.pointer)。
JS
$(function() {
$(window).load(function() {
$('.pointer').css({"width": "60px", "height": "60px"});
});
});我只做了更改width和height部分,如果我不够清楚,请告诉我,我会尽我最大的努力来消除您的困惑。
发布于 2016-03-25 10:05:33
JS
$(function() {
$(window).load(function() {
$('.pointer').css({'height':($(window).height())+'px'});
});
});发布于 2016-03-25 12:21:58
这里有一种方式来弹跳宽度和高度。我会存储动画点和循环通过动画功能多次。
这里的其他一些人给了你滚动事件的策略,但是你也要求有弹跳的效果。
希望这能帮上忙,蒂姆
$(document).ready(function(){
$("button").click(function(){
$("div").animate({
opacity: '0.5',
height: '150px',
width: '150px'
});
$("div").animate({
opacity: '0.5',
height: '50px',
width: '50px'
});
$("div").animate({
opacity: '0.5',
height: '100px',
width: '100px'
});
$("div").animate({
opacity: '0.5',
height: '75px',
width: '75px'
});
$("div").animate({
opacity: '0.5',
height: '200px',
width: '200px'
});
});
});<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<button>Start Animation</button>
<div style="background:#98bf21;height:100px;width:100px;position:absolute;"></div>
https://stackoverflow.com/questions/36217122
复制相似问题