0

I have checked similar topics but did not find a satisfactory answer. My website is very long in height so it takes long to load. I have a fixed div which should only appear when user scrolls until the buttom. But the hidden div appears when I enter the page, I don't want it to appear in the loading process. Any help appreciated.

.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>
2
  • So why don't you just hide it with css, then unhide it in your javascript? Commented Aug 15, 2013 at 23:43
  • Use display: none;. Commented Aug 15, 2013 at 23:44

2 Answers 2

3

An ugly but effective answer, add inline styling to the element.

<div style="display: none;"></div>
Sign up to request clarification or add additional context in comments.

Comments

0

The div to display none then fire fade in effect after the window is loaded

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

$('window').load(function() {
  $('#div').fadeIn();
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.