gpt4 book ai didi

jquery -
的滚动条在动画过程中会消失吗?有什么想法可以解决这个问题吗?

转载 作者:行者123 更新时间:2023-12-01 01:10:40 25 4
gpt4 key购买 nike

看起来在pre标签的动画过程中,pre的滚动条会消失,但稍后当动画结束时会出现。我怎样才能让它出现在整个动画中?

<script type="text/javascript">
$(document).ready(function(){
$('pre').hover(
function(){
if($(this).width()==520){
$(this).animate({width:'800'},400);
$(this).css({border:'2px solid #2B99E6'});
}
},
function(){
if($(this).width()==800){
$(this).animate({width:'520'},400);
$(this).css({border:'2px solid #555555'});
}
}
);
});
</script>

<style type="text/css">
pre {
background: url("images/source.jpg") no-repeat scroll 0 0 #333333;
border: 2px solid #555555;
color: green;
font-family: arial;
margin: 0;
overflow: scroll;
padding: 30px 0 20px;
position: relative;
width: 520px;
display: block;
}
</style>

<pre>
test it: www.gbin1.com
</pre>

最佳答案

将 CSS 属性更改为

pre {
overflow:scroll !important;
}

如本例所示 http://jsfiddle.net/vTBV4/

然而,!important标志可能不适用于所有浏览器:(但据我所知,这是确保滚动可见的唯一方法,因为 jquery animate 在要动画的元素上隐式设置内联样式 overflow: hidden

另一个选项可能是创建父容器并为其设置动画,而不是 <pre> .

关于jquery - <pre>的滚动条在动画过程中会消失吗?有什么想法可以解决这个问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6175196/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com