前两个链接显示一个工作的旋转图标,但我希望它工作的第三个链接将无法正常工作......
https://jsfiddle.net/752tfqyu/17/
我创建的 JSfiddle 有效。当我把 JSfiddle 中的所有内容并在服务器上测试它时:它不起作用:http ://cdubach.com/inc/test.php
http://cdubach.com/pages/home/index.php 我有一个问题,图标不会旋转。
用于旋转图标的主要 Javascript/Jquery;
/* [(START)Rotate Icon:SCroll Down] ----------------> */
$(document).ready(function() {
$(window).scroll(function() {
if ($(window).scrollTop() < 300) {
$("#rotate").css({
"top": $(window).scrollTop() + "px"
});
}
});
});
/* [(END)Rotate Icon:SCroll Down] ------------------> */
var looper;
var degrees = 0;
function rotateAnimation(el, speed) {
var elem = document.getElementById(el);
if (navigator.userAgent.match("Chrome")) {
elem.style.webkitTransform = "\"rotate(" + degrees + "deg)\"";
} else {
elem.style.transform = "\"rotate(" + degrees + "deg)\"";
}
looper = setTimeout('rotateAnimation(\'' + el + '\',' + speed + ')', speed);
degrees++;
if (degrees > 359) {
degrees = 1;
}
}