javascript - Anchor doesn't work in chrome and safari browsers -
i have problem: html anchor doesn't work in chrome , safari. page goes down instead of up. have html:
<a id="to-top"></a> <a class="button totop" href="#" onclick="document.getelementbyid('to-top').scrollintoview(true);return false;">Вверх</a>
and javascript code:
var topscreen = window.pageyoffset ? window.pageyoffset : document.body.scrolltop; var myscreen = screen.availheight; if(topscreen > (myscreen / 3)) { $(".totop").fadeto(0, 1.0); } else { $(".totop").fadeto(0, 0);
scss:
.totop { display: none; position: fixed; bottom: 20px; right: 20px; z-index: 999999; transition: opacity 1s ease-out; outline: none; &:hover { transition-delay:0s; } { color: #fff; text-decoration: none; &:hover { color: #000; } } }
what wrong? besides, element stays focused after click.
now, since have not set jsfiddle, it's difficult figure out happening in project , expected. however, have made small fiddle that, think, solves problem.
html
<div id="to-top"></div> <a class="button totop" href="#to-top">Вверх</a>
css
#to-top { height: 200vh; }
the problem in project trying jump <a>
-tag, while anchor-jump seems work div
s contain id
. please try fiddle i've added , see if changing element of to-top
div
works you.
in future, should add own fiddle question though.
Comments
Post a Comment