that.iconDisplayPercent = that.scrollPosition / that.headerHeight
$('#icon').css({'opacity':that.iconDisplayPercent})
that.iconRotatePercent = Math.min(1,that.scrollPosition/that.headerHeight)
$('#icon').css({'transform':'rotate('+that.iconRotatePercent*180+'deg)'})
Original CSS class:
.icon{
position: fixed;
right: 25px;
color: white;
top:20px;
visibility: visible;
opacity: 0;
font-size: x-large;
}
Above code (only part of) can not work on Safari, but it is perfect on Chrome, does anyone know what's going on here?
This is a function in our website, the icon will rotate while the screen scrolling, so I calculate a percentage to pass the opacity and rotate degree, but it seems like Safari could not add this inline CSS dynamic, but Chrome is okay. lol, totally confused.
Note: I define this element like this: i#icon.fa.fa-chevron-circle-up(class='icon') so the 'icon' is both id and class name, in the initial state, it follows the .icon{} class, but i get the #icon to add inline css to override original one.