简体   繁体   English

CSS3过渡流程问题

[英]Issue with CSS3 transition flow

I have setup a background transition on this page . 我已经在此页面上设置了背景转换。

The first area of the page "Il Blog - Leggi tutti gli articoli" and "Gli Eventi - Leggi tutti gli eventi" shows a list of different post types in tiles. 页面“ Il博客-Leggi tutti gli articoli”“ Gli Eventi-Leggi tutti gli eventi”的第一部分显示了磁贴中不同帖子类型的列表。 When hovering on one of them, the transition start. 将鼠标悬停在其中一个上时,过渡开始。 When moving out the mouse, the other transition start. 移出鼠标时,另一个过渡开始。 Until there everything's fine. 直到那里一切都很好。

The problem shows when I move the mouse out of a tile BEFORE the transition is completed. 问题显示在过渡完成之前将鼠标移出图块时。

I am trying to figure out what's missing in my CSS but I can't find it. 我正在尝试找出CSS中缺少的内容,但找不到。

I know I could probably solve the problem moving the transition to a jQuery script, but I prefer using a CSS only approach. 我知道我可能可以解决将过渡过渡到jQuery脚本的问题,但我更喜欢使用仅CSS的方法。

Here is an SCSS excerpt of the involved elements: 这是所涉及元素的SCSS摘录:

article {

    @include box-shadow(0 0 2px $primary-color);
    @include transition(all 1s ease-in-out);
    @include border-radius(2px);

    background-image: url('../images/concrete_wall.png');

    &:hover {
      @include box-shadow(0 0 4px $primary-color);
      background-image: url('../images/concrete_wall_2.png');

    }
}

Here's the produced CSS, just in case someone prefers to see it this way: 这是产生的CSS,以防万一有人喜欢这样看:

body.home #posts-area #posts-area-columns #home-posts-list article, body.home #posts-area #posts-area-columns #featured-events-list article {
  -webkit-box-shadow: 0 0 2px #222222;
  -moz-box-shadow: 0 0 2px #222222;
  box-shadow: 0 0 2px #222222;
  -webkit-transition: all 1s ease-in-out;
  -moz-transition: all 1s ease-in-out;
  -o-transition: all 1s ease-in-out;
  transition: all 1s ease-in-out;
  -webkit-border-radius: 2px;
  -moz-border-radius: 2px;
  -ms-border-radius: 2px;
  -o-border-radius: 2px;
  border-radius: 2px;
  background-image: url("../images/concrete_wall.png");
}
/* line 60, ../sass/_home.scss */
body.home #posts-area #posts-area-columns #home-posts-list article:hover, body.home #posts-area #posts-area-columns #featured-events-list article:hover {
  -webkit-box-shadow: 0 0 4px #222222;
  -moz-box-shadow: 0 0 4px #222222;
  box-shadow: 0 0 4px #222222;
  background-image: url("../images/concrete_wall_2.png");
}

the second transition you include in the hover is useless. 悬停中包含的第二个过渡是无用的。 The ease-in-out makes it come fade in and fade out. 缓入使它渐入渐出。

article {

    @include box-shadow(0 0 2px $primary-color);
    @include transition(all 1s ease-in-out); //Note i changed it to eas-in-out
    @include border-radius(2px);

    background-image: url('../images/concrete_wall.png');

    &:hover {
      @include box-shadow(0 0 4px $primary-color);
      background-image: url('../images/concrete_wall_2.png');
      //Note I removed the unnecessary transition
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM