如何为 css 倾斜过渡添加 jquery 回退?

Posted

技术标签:

【中文标题】如何为 css 倾斜过渡添加 jquery 回退?【英文标题】:How to add jquery fallback for css skew transition? 【发布时间】:2017-02-28 12:11:35 【问题描述】:

我正在使用悬停 css 过渡。但是我需要支持min ie 8。我想添加jquery fallback,这样如果css过渡不起作用,jquery动画就会开始工作。请检查这个css skew transition,我需要把这个动画转换成jquery。

CSS:

@-webkit-keyframes hvr-wobble-bottom 
  16.65% 
    -webkit-transform: skew(-12deg);
    transform: skew(-12deg);
  

  33.3% 
    -webkit-transform: skew(10deg);
    transform: skew(10deg);
  

  49.95% 
    -webkit-transform: skew(-6deg);
    transform: skew(-6deg);
  

  66.6% 
    -webkit-transform: skew(4deg);
    transform: skew(4deg);
  

  83.25% 
    -webkit-transform: skew(-2deg);
    transform: skew(-2deg);
  

  100% 
    -webkit-transform: skew(0);
    transform: skew(0);
  


@keyframes hvr-wobble-bottom 
  16.65% 
    -webkit-transform: skew(-12deg);
    transform: skew(-12deg);
  

  33.3% 
    -webkit-transform: skew(10deg);
    transform: skew(10deg);
  

  49.95% 
    -webkit-transform: skew(-6deg);
    transform: skew(-6deg);
  

  66.6% 
    -webkit-transform: skew(4deg);
    transform: skew(4deg);
  

  83.25% 
    -webkit-transform: skew(-2deg);
    transform: skew(-2deg);
  

  100% 
    -webkit-transform: skew(0);
    transform: skew(0);
  


.hvr-wobble-bottom 
  display: inline-block;
  vertical-align: middle;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -moz-osx-font-smoothing: grayscale;
  -webkit-transform-origin: 100% 0;
  transform-origin: 100% 0;

.hvr-wobble-bottom:hover, .hvr-wobble-bottom:focus, .hvr-wobble-bottom:active 
  -webkit-animation-name: hvr-wobble-bottom;
  animation-name: hvr-wobble-bottom;
  -webkit-animation-duration: 1s;
  animation-duration: 1s;
  -webkit-animation-timing-function: ease-in-out;
  animation-timing-function: ease-in-out;
  -webkit-animation-iteration-count: 1;
  animation-iteration-count: 1;

请有人告诉我要使用的确切 jquery。我不是 jquery 方面的专家,所以如果你能帮助我,我会非常感激。

【问题讨论】:

【参考方案1】:

您可以检查this 是否存在偏差,但我不知道您是否会找到任何针对摆动的后备方案。您可以尝试使用this 之类的东西。但请记住graceful degradation 的原则 - 跨浏览器兼容不一定(并且通常应该不)意味着跨浏览器相同

【讨论】:

以上是关于如何为 css 倾斜过渡添加 jquery 回退?的主要内容,如果未能解决你的问题,请参考以下文章

如何为 vh vw 编写 css 回退

jquery 如何为动态添加的元素添加样式

手写笔中的 CSS3 过渡 - 如何为 IE9 降级

jQuery如何为指定标签添加和删除一个样式

如何为 Angular.js 显示/隐藏添加平滑过渡?

在 jQuery 中,如何为“最大高度”CSS 属性设置动画?