为什么元素在滚动时闪烁 [英] why does Element flickers on scroll

查看:108
本文介绍了为什么元素在滚动时闪烁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个反馈框,它必须位于页面的右上角,并应使用滚动条向上和向下滚动。但是如何阻止它在IE和chrome CSS中为该div闪烁:



I'm having a feedback box, which has to be at the right corner of the page and should scroll up and down with the scroll bar. But how to stop its flickering in IE and chrome CSS for that div is:

#showSurvey
{
position: relative;
width: 230px;
top: 190px;
float: right;
height: 60px;
}



和javascript将其保持在最高位置




and javascript to keep it at top is

var wintop = $(window).scrollTop(); if(wintop >= 190) {$('#showSurvey').css('top', (wintop + 10));} else{
$('#showSurvey').css('top', '190px');
}



使用这个div闪烁很多,看起来很难看,任何人都可以请帮助



javascript css

推荐答案

window )。scrollTop(); if (wintop> = 190 ){
(window).scrollTop(); if(wintop >= 190) {


(< span class =code-string>' #showSurvey')。css(' top',(wintop + 10 ));} else {
('#showSurvey').css('top', (wintop + 10));} else{


' #showSurvey') .css(' top'' 190px');
}
('#showSurvey').css('top', '190px'); }



使用这个div闪烁很多,看起来很难看,任何人都可以请帮助



javascript css


这篇关于为什么元素在滚动时闪烁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆