我有巨大的绿色div块(屏幕高度)。当我将其中一个悬停时 - 它将颜色变为黄色,并将块中的图像“滑行”。当我滚动 - 块的颜色回滚到绿色(和图像'slidesdouwn)',并且在停止滚动之后 - 块再次变为yeallow(并且图像'再次滑动')。在我的滚动期间,如何保持div块悬停?
<div class="news-block"><img scr=''></div>
<div class="news-block"><img scr=''></div>
<div class="news-block"><img scr=''></div>
<div class="news-block"><img scr=''></div>
<div class="news-block"><img scr=''></div>
<div class="news-block"><img scr=''></div>
<style>
.news-block {
width: 33%;
color: green;
height: 700px;
}
</style>
<script>
$(".news-block").hover(
function () {
$(this).css({color: 'yellow'});
$(this).find('img').slideUp(180, function() {});
},
function () {
$(this).css({color: 'green'});
$(this).find('img').slideDown(180, function() {});
}
);
</script>
溶液。或者我可以只在用户不滚动时才能取消?如何检测NOT滚动?
$(".news-block").on('mouseover',
function () {
$(this).find('.event-info').stop().hide().css({opacity: 0});
$(this).find('.picture-block').stop().slideUp(180, function() {
$(this).find('.news-text').stop().show().animate({opacity: 1}, 500);
$(this).find('#voting-block').stop().show().animate({opacity: 1}, 500);
});
}
);
$(".news-block").on('mouseout',
function () {
--------------if not scrooll do the next ---------------
$(this).find('.event-info').stop().hide().css({opacity: 0});
$(this).find('.picture-block').stop().slideUp(180, function() {
$(this).find('.news-text').stop().show().animate({opacity: 1}, 500);
$(this).find('#voting-block').stop().show().animate({opacity: 1}, 500);
});
}
);
答案 0 :(得分:0)
您可以使用CSS悬停,它也可以在滚动期间使用,并可以向下滑动图像。
<div class="news-block">
<img src="http://lorempizza.com/200/120" alt="pizza">
</div>
<div class="news-block">
<img src="http://lorempizza.com/200/120" alt="pizza">
</div>
<div class="news-block">
<img src="http://lorempizza.com/200/120" alt="pizza">
</div>
function checkfileexists(fn){
var destFolder = DriveApp.getFolderById('...');
var destFileId = destFolder.getFilesByName(fn);
return destFileId.hasNext();
}