that.displayIcon = that.scrollPosition / that.headerHeight
$('#icon').css({'opacity':that.displayIcon})
that.rotateIcon = Math.min(1,that.scrollPosition/that.headerHeight)
$('#icon').css({'transform':'rotate('+that.rotateIcon*180+'deg)'})
Original CSS class:
.icon{
position: fixed;
right: 25px;
color: white;
top:20px;
visibility: visible;
opacity: 0;
font-size: x-large;
}
The code above (only part of it) is causing issues on Safari, while working perfectly fine on Chrome. Does anyone have any idea what might be causing this discrepancy?
This function on our website rotates an icon as the user scrolls down the page. I use percentages to adjust the opacity and rotation degree of the icon dynamically. However, it seems like Safari is not able to handle this inline CSS manipulation properly, whereas Chrome has no issues at all. It's quite confusing.
Note: I have defined the element like this: i#icon.fa.fa-chevron-circle-up(class='icon') where 'icon' serves as both an id and a class name. Initially, it follows the .icon{} class styling, but then I use #icon to add inline css to override the original styles.