javascript - 带有旋转 Logo 的整页滚动

标签 javascript jquery css rotation fullpage.js

我有一个使用 Fullpage.js 的网站,我需要在滚动浏览每个部分时将 Logo 旋转 180 度。

我该怎么做

这是链接: http://www.bfgstudio.co.uk/testing/VIM/

最佳答案

您应该使用 onLeave 回调,或者如果您愿意,也可以使用 afterLoad 回调。

这样您就可以在从一张幻灯片移动到另一张幻灯片时触发一些东西。

jQuery:

$.fn.fullpage({
    afterLoad: function (anchor, index) {
        $('#cog').toggleClass('active');
    }
});


CSS

#cog {
    background: white;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    position: fixed;
    top: 20px;
    left: 20px;
}
#cog.active {
    transform: rotate(180deg);
    -webkit-transform: rotate(180deg);
    -moz-transform: rotate(180deg);
    -webkit-transition: all 0.3s ease-out;
    -moz-transition: all 0.3s ease-out;
    -o-transition: all 0.3s ease-out;
    transition: all 0.3s ease-out;
}

Live example

关于javascript - 带有旋转 Logo 的整页滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22499557/

相关文章:

javascript - 使用回调()加载多个图像

javascript - 带闭包的 For 循环保存状态

javascript - 如何使用对象的键对对象数组进行排序?

jquery - 单击后翻转卡不会卡住

jquery 理解 $ ('#name' ).load(...)

css - 将文本对齐到 Bootstrap 上相邻按钮的中心

javascript - 处理中的超时休息请求

javascript - 使用 HOC 在 Next.js getInitialProps 中访问使用的 React.Context

php - 显示来自 TABLE 的具有不同大小的个体的图像

java - Vaadin 中的着色表