0

I have a problem with my new website. I have a div used as a "button to the top of the page".

When i scroll down with the wheel mouse, the div appears BUT changes its position to the right (and a scrollbar appears). I have this problem only with ie 11...

Weird... or not, idon't know, I have been searching a few days now and i have found nothing.

My css:

    #btn_up
{
display: block;
width: 100px;
height: 100px;
background-image: url(../img/pagetop.svg); background-repeat: no-repeat;
position: fixed;
bottom: 15px;
right: 25px;
z-index: 1000;
cursor: pointer;
display:none;
}

And my javascript:

$(document).ready(function(){

    $(window).scroll(function(){
        if ($(this).scrollTop() > 100) {
            $('#btn_up').fadeIn();
        } else {
            $('#btn_up').fadeOut();
        }
    });

    $('#btn_up').click(function(){
        $('html, body').animate({scrollTop : 0},800);
        return false;
    });
});

What do i miss???

Kins
  • 11
  • 1
  • 4

1 Answers1

0

I've used your code to create a quick jsFiddle to reproduce the issue, but all seems to be OK in IE11/win7 as well as in FF and Chrome. Could you check your issue using my code, and maybe update the source if something is missing to see the issue?

I've replaced only this part:

background-image: url(../img/pagetop.svg); background-repeat: no-repeat;

with:

background-color:red;

Can you explain what you mean by saying 'div changes its position to the right'?

As far I can tell - div shows up on the right side of the page due to "right: 25px;" specified inside the "#btn_up" selector. I guess it's not your main issue, is it?

rbtbar
  • 87
  • 1
  • 5
  • Hello. So how can i explain this...? mmm... The div show up and it moves to the right when i use the scrolling bar! So come a horizontal scrollbar (who grows) which i have not usually. It's just a IE/win8 problem apparently! – Kins Nov 25 '14 at 10:22