4

我正在尝试添加过渡,但它不起作用

我更想知道为什么它不起作用

这是我的代码

<div class="subNavigation">
                        <ul>
                            <li>درباره بانک مهر</li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 1</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 2</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 3</a></li>
                            <li><a href="javascript:void(0)">درباره بانک مهر 4</a></li>
                        </ul>
                    </div>

和CSS

.subNavigation {
 width: 900px;
 height: 274px;
 position: absolute;
 top: 40px;
 right: 0;
 padding: 30px 60px 0 0;
 }
 /* line 126, ../sass/style.scss */
 .subNavigation ul {
 float: right;
 }
 /* line 130, ../sass/style.scss */
 .subNavigation li {
 width: 153px;
 *zoom: 1;
 margin-top: 4px;
 padding-right: 2px;
 padding-bottom: 4px;
 border-bottom: 1px dotted #b4b4b4;
 }
 /* line 38, D:/Ruby193/lib/ruby/gems/1.9.1/gems/compass-      0.12.2/frameworks/compass/stylesheets/compass/utilities/general/_clearfix.scss */
.subNavigation li:after {
 content: "";
 display: table;
 clear: both;
 }
/* line 138, ../sass/style.scss */
.subNavigation li:first-child {
width: 155px;
height: 24px;
margin-top: 0;
margin-bottom: 14px;
color: #f7931e;
border-bottom: 1px solid #dddddd;
padding-right: 0;
font-size: 16px;
line-height: 24px;
}
/* line 151, ../sass/style.scss */
 .subNavigation a {
  float: right;
  font-size: 13px;
   height: 24px;
   line-height: 24px;
   padding-right: 2px;
  color: #222;
  -webkit-transition: all, 0.2s, ease-in;
  -moz-transition: all, 0.2s, ease-in;
  -o-transition: all, 0.2s, ease-in;
   transition: all, 0.2s, ease-in;
   }
  /* line 160, ../sass/style.scss */
 .subNavigation a.eng {
  font-family: tahoma;
  }
 /* line 164, ../sass/style.scss */
 .subNavigation a:hover {
  padding-right: 10px;
  border-right: 4px solid #f7941d;
  color: #19ae61;
  }

小提琴

4

2 回答 2

12

一个简单的错误:

-webkit-transition: all, 0.2s, ease-in;
-moz-transition: all, 0.2s, ease-in;
-o-transition: all, 0.2s, ease-in;
transition: all, 0.2s, ease-in;

改成:

-webkit-transition: all 0.2s ease-in;
-moz-transition: all 0.2s ease-in;
-o-transition: all 0.2s ease-in;
transition: all 0.2s ease-in;

演示:http: //jsfiddle.net/X5UBF/1/

转换值不是逗号分隔的。它们是一个单一的声明。如果你想声明多个转换,那么你用逗号分隔它们。

请参阅W3C 文档或/和CSS3.info

Value: <single-transition> [ ‘,’ <single-transition> ]*

在哪里<single-transition>

<single-transition> = <transition-property> <transition-duration> <transition-timing-function> <transition-delay>

因此,逗号分隔的示例是:

transition: opacity 0.5s ease-in, width 1.5s ease-out;
/* 0.5s for an opacity transform while 1.5s for a width transform */
于 2013-06-13T21:28:30.550 回答
1

过渡声明不当:

 -webkit-transition: all 0.2s ease-in;  /* Chrome 1-25, Safari 3.2+ */
 -moz-transition: all 0.2s ease-in;  /* Firefox 4-15 */
 -o-transition: all 0.2s ease-in;  /* Opera 10.50–12.00 */
 transition: all 0.2s ease-in;  /* Chrome 26, Firefox 16+, IE 10+, Opera 12.10+ */
于 2013-06-13T21:29:32.050 回答