Good evening, I have this code that works one part and the other not.
$(document).on('scroll', function() {
/* funciona */
var max_opacity_arrow = 0.3;
var min_opacity_arrow = 0.1;
var opacity_arrow = max_opacity_arrow * (1 - $(this).scrollTop() / $(window).height());
if (opacity_arrow > min_opacity_arrow) {
opacity_arrow = opacity_arrow;
} else {
opacity_arrow = min_opacity_arrow; }
$('div.home.show div.bottom.arrow').css('opacity', opacity_arrow);
/* não funciona */
var max_pespective_rotatex = 0;
var min_pespective_rotatex = 90;
var rotateX = max_pespective_rotatex * (1 - $(this).scrollTop() / $(window).height());
if (rotateX > min_pespective_rotatex) {
rotateX = rotateX;
} else {
rotateX = min_pespective_rotatex; }
$('div.primeirapagina div.mainpespective').css('transform', rotateX + 'deg'); });
The lower part in question is a copy of the above, but only when I use TRANSFORM that does not work, if I change there in the end .css ('transform' the transform to anything else, it works but if I return it the transform does not work, what I want is that just as when I scroll the page the arrow disappears, I want a div to go spinning until it is facing 0 or how could I do it any other way that works? / p>