在 jQuery 之后加载 CSS

标签 css

我检查过类似的主题,但没有找到满意的答案。 My website高度很长,所以需要很长时间才能加载。我有一个固定的 div,它应该只在用户滚动到按钮时出现。但是当我进入页面时隐藏的div出现了,我不希望它出现在加载过程中。任何帮助表示赞赏。

.homepage
{
    width: 76px;
    height: 62px;
    position: fixed;
    top: 85%;
    right: 182px;
    background-image: url(anasayfa.png);
    border-radius: 10px;
}

.homepage:hover
{
    top: 85.3%;
}


.scrollup
{
    width: 76px;
    height: 62px;
    background-image: url(yukaricik.png);
    position: fixed;
    top: 85%;
    right: 96px;
    border-radius: 10px;
}

.scrollup:hover
{
    top: 85.3%;
}

.nextpage {
    width: 76px;
    height: 62px;
    position: fixed;
    top: 85%;
    right: 10px;
    background-image: url(sonrakisayfa.png);
    border-radius: 10px;
}

.nextpage:hover
{
    top: 85.3%;
}

<script>

$(document).ready(function () {
    $(window).scroll(function () {
        if ($(window).scrollTop() > 13500) {
            $(".homepage").fadeIn();
        } else {
            $(".homepage").fadeOut();
        }
    });
});

$(document).ready(function() {
    $(window).scroll(function(){
        if ($(window).scrollTop() > 13500){
            $(".scrollup").fadeIn();
        } else {
            $(".scrollup").fadeOut();
        }
    });
});

$(document).ready(function(){
  $(".scrollup").click(function(){
    $('html, body').animate({scrollTop: '0px'}, 300);
  });
});

$(document).ready(function () {
    $(window).scroll(function () {
        if ($(window).scrollTop() > 13500) {
            $(".nextpage").fadeIn();
        } else {
            $(".nextpage").fadeOut();
        }
    });
});

</script>

最佳答案

一个丑陋但有效的答案,向元素添加内联样式。

<div style="display: none;"></div>

关于在 jQuery 之后加载 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18263696/

相关文章:

css - :after and :before pseudo-element selectors in Sass

jquery - 第一次使用这个 "sliding animation on menu hover with jQuery"Fiddle 悬停时如何关闭动画?

html - 如何在 html 上左右对齐表单元素

CSS3 字体不适用于选择框选项,IE

CSS 3 形状 : "Inverse Circle" or "Cut Out Circle"

css - facebook messenger bot 使用 CSS 移动位置

html - 如何创建一个微小的水平滚动条来一张一张地内联显示图像?

类似于 Photoshop ColorPicker 的 CSS3 透明渐变

css - 为什么 Firefox 对待 Helvetica 的方式与 Chrome 不同?

c# - GridView 在 Firefox 和 IE 中不应用 css