首页 新闻 会员 周边 捐助

网页滚动效果优化

0
悬赏园豆:10 [待解决问题]

在asp中,如果一个网页中多处实现滚动效果,发布后滚动很卡,请问如何优化

learningcom的主页 learningcom | 初学一级 | 园豆:148
提问于:2012-11-09 10:20
< >
分享
所有回答(2)
1

把脚本贴出来才能帮你看如何优化呢?

你的滚动中有没有图片?如果有就等到滚动到展示位的时候再加载

田林九村 | 园豆:2367 (老鸟四级) | 2012-11-09 10:24

有两组图片图片滚动,还有一组文字滚动,都是用的marqueen

支持(0) 反对(0) learningcom | 园豆:148 (初学一级) | 2012-11-13 09:57

1.      <script>
                                                        jQuery(function($) {
                                                            $('#imagenews').slideBox({
                                                                duration: 0.3, //滚动持续时间,单位:秒
                                                                easing: 'linear', //swing,linear//滚动特效
                                                                delay: 5, //滚动延迟时间,单位:秒
                                                                hideClickBar: false, //不自动隐藏点选按键
                                                                clickBarRadius: 10
                                                            });
                                                        });
                                                    </script>

2.<marquee onmouseover="this.stop()" direction="up" scrollamount="1" height="190px"
                            scrolldelay="3" onmouseout="this.start()">

3. <script>
                                            var speed = 20;
                                            var tab = document.getElementById("demo");
                                            var tab1 = document.getElementById("demo1");
                                            var tab2 = document.getElementById("demo2");
                                            tab2.innerHTML = tab1.innerHTML;
                                            function Marquee() {
                                                if (tab2.offsetWidth - tab.scrollLeft <= 0) {
                                                    tab.scrollLeft -= tab1.offsetWidth
                                                } else {
                                                    tab.scrollLeft++;
                                                }
                                            }
                                            var MyMar = setInterval(Marquee, speed);
                                            tab.onmouseover = function() { clearInterval(MyMar) };
                                            tab.onmouseout = function() { MyMar = setInterval(Marquee, speed) };
                                        </script>

支持(0) 反对(0) learningcom | 园豆:148 (初学一级) | 2012-11-13 10:06

@learningcom: 那应该是图片加载过多导致

修改建议:不要上来就把图片全部加载,等到滚动到展示位的时候再加载图片

支持(0) 反对(0) 田林九村 | 园豆:2367 (老鸟四级) | 2012-11-13 10:26

@田林九村: 谢谢

支持(0) 反对(0) learningcom | 园豆:148 (初学一级) | 2012-11-13 16:20
1

主要看你的JS滚动脚本,还有滚动的数据量

chenping2008 | 园豆:9836 (大侠五级) | 2012-11-09 10:25

一个页面中三处都是滚动,其中两组图片,一组文字

支持(0) 反对(0) learningcom | 园豆:148 (初学一级) | 2012-11-13 09:59

1.      <script>
                                                        jQuery(function($) {
                                                            $('#imagenews').slideBox({
                                                                duration: 0.3, //滚动持续时间,单位:秒
                                                                easing: 'linear', //swing,linear//滚动特效
                                                                delay: 5, //滚动延迟时间,单位:秒
                                                                hideClickBar: false, //不自动隐藏点选按键
                                                                clickBarRadius: 10
                                                            });
                                                        });
                                                    </script>

2.<marquee onmouseover="this.stop()" direction="up" scrollamount="1" height="190px"
                            scrolldelay="3" onmouseout="this.start()">

3. <script>
                                            var speed = 20;
                                            var tab = document.getElementById("demo");
                                            var tab1 = document.getElementById("demo1");
                                            var tab2 = document.getElementById("demo2");
                                            tab2.innerHTML = tab1.innerHTML;
                                            function Marquee() {
                                                if (tab2.offsetWidth - tab.scrollLeft <= 0) {
                                                    tab.scrollLeft -= tab1.offsetWidth
                                                } else {
                                                    tab.scrollLeft++;
                                                }
                                            }
                                            var MyMar = setInterval(Marquee, speed);
                                            tab.onmouseover = function() { clearInterval(MyMar) };
                                            tab.onmouseout = function() { MyMar = setInterval(Marquee, speed) };
                                        </script>

支持(0) 反对(0) learningcom | 园豆:148 (初学一级) | 2012-11-13 10:06

@learningcom: 应该是图片那边的滚动比较的卡吧?  你滚动的图片大啊?

支持(0) 反对(0) chenping2008 | 园豆:9836 (大侠五级) | 2012-11-13 10:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册