Jquery 切换 div 并随淡入淡出旋转

标签 jquery css jquery-animate toggle

好的,我在网站上发现了一个功能,对我来说它看起来很棒,我一直在尝试重新创建一个类似的功能,但我什至无法接近。

您可以在此处查看该功能 - http://mitchell-me.com/ 如果您单击服务。有机电。

当您单击按钮时,圆圈会旋转,圆圈上的图标会淡入新图标中,并且 div 会淡出/淡入。我一直在尝试使用 jquery 切换来做到这一点,但我无法接近。

我希望在这里得到任何/所有建议或简单的代码示例。在此先感谢我已经为此失去理智了 3 天。

最佳答案

他们的 javascript 似乎正在改变 CSS。 CSS 负责转换和淡化工作。

snooped through their javascript ...

$("#service li").click(function(e){e.preventDefault();var index=$(this).index();$('#service li').removeClass("active");if(!$(this).hasClass("active")&&!intrans){intrans=true;switch(index){case 0:TweenLite.to($(".dial"),1.5,{css:{shortRotation:0},ease:Expo.easeInOut});TweenLite.to($(".gear"),1.5,{css:{autoAlpha:0,rotation:0},ease:Expo.easeInOut});TweenLite.to($(".bulb"),1.5,{css:{autoAlpha:1,rotation:0},ease:Expo.easeInOut});$('#electric, #electric1').delay(800).animate({opacity:1},{easing:easeType,duration:"100",complete:function(){}});$('#mechanic, #mechanic1').delay(200).animate({opacity:0},{easing:easeType,duration:"100",complete:function(){intrans=false}});break;case 1:TweenLite.to($(".dial"),1.5,{css:{shortRotation:115,transformOrigin:"103px 103px"},ease:Expo.easeInOut});TweenLite.to($(".bulb"),1.5,{css:{autoAlpha:0,x:0,y:0,rotation:120,transformOrigin:"20px 40px"},ease:Expo.easeInOut});TweenLite.to($(".gear"),1.5,{css:{autoAlpha:1,x:0,y:0,rotation:120,transformOrigin:"50px 48px"},ease:Expo.easeInOut});$('#electric, #electric1').delay(200).animate({opacity:0},{easing:easeType,duration:"100",complete:function(){}});$('#mechanic, #mechanic1').delay(800).animate({opacity:1},{easing:easeType,duration:"100",complete:function(){intrans=false}});break;}}

看起来他们正在使用 TweenliteTweenmax

关于Jquery 切换 div 并随淡入淡出旋转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14012010/

相关文章:

css - Laravel 4 - 无论我输入什么代码,我的 css 页面都会出错

javascript - 有没有办法减少 html/css 中每个页面包含的内容的复制粘贴?

jQuery animate() 不受控制地随机上下滑动

jquery - 使用 animate.scrolltop 和 (target).offset().top 占固定标题;

jquery - 如何将 html 选择选项返回到其原始顺序?

javascript - 2 谷歌地图相互冲突

javascript - 为什么会抛出错误?

java - JSP 不向 JQuery AJAX 返回数据

html - div 背景没有出现在 live ie 和 firefox 中

jquery运行很快。仅适用于 Chrome