我有一个页面显示可以通过 jQuery 调整大小的人物图片。我正在使用一个精灵图像,它显示 3 个正方形,当您选择/悬停它们时它们会发生变化。我正在使用 CSS3 Transition & Transform (RotateY) 为更改设置动画。转换和转换在 Chrome (v22) 中有效,但在 Firefox (v16) 中无效。
我创建了一个 jsFiddle 示例:http: //jsfiddle.net/WPEbW/7/
<div id="divOptions" runat="server" style="padding: 0 10px; margin: 10px; overflow: hidden; zoom: 1">
<div style="float: left">
<div id="divSmallImage" runat="server" class="ResizeImages Small" title="Small">
</div>
<div id="divMediumImage" runat="server" class="ResizeImages Medium Selected" title="Medium">
</div>
<div id="divLargeImage" runat="server" class="ResizeImages Large" title="Large">
</div>
</div>
</div>
.ResizeImages { cursor: pointer; display: inline-block; background-position: 0; -moz-transform:rotateY(0deg) }
.ResizeImages:hover { box-shadow: #CCC 1px 1px 5px; -webkit-transition: none; -moz-transition: none; -o-transition: none; transition: none; }
.ResizeImages.Selected { -webkit-transition: background-position 0 .4s,-webkit-transform 1s; -webkit-transform: rotateY(180deg); -moz-transition: background-position 0 .4s,-moz-transform 1s; -moz-transform: rotateY(180deg); -o-transition: background-position 0 .4s,-o-transform 1s; -o-transform: rotateY(180deg); transition: background-position 0 .4s,transform 1s; transform: rotateY(180deg); }
.ResizeImages.Small { background: url('https://www.new-innov.com/RMSImages/square_sprite.png') 0 0 no-repeat; width: 12px; height: 12px; }
.ResizeImages.Small:hover { background-position: 0 -12px; }
.ResizeImages.Small.Selected { background-position: 0 -24px; }
.ResizeImages.Medium { background: url('https://www.new-innov.com/RMSImages/square_sprite.png') -12px 0 no-repeat; width: 16px; height: 16px; }
.ResizeImages.Medium:hover { background-position: -12px -16px; }
.ResizeImages.Medium.Selected { background-position: -12px -32px; }
.ResizeImages.Large { background: url('https://www.new-innov.com/RMSImages/square_sprite.png') -28px 0 no-repeat; width: 20px; height: 20px; }
.ResizeImages.Large:hover { background-position: -28px -20px; }
.ResizeImages.Large.Selected { background-position: -28px -40px; }
$(document).ready(function() {
function SetSize(selectedImage) {
if (typeof selectedImage !== 'undefined') {
$('.ResizeImages.Selected').removeClass('Selected');
$(selectedImage).addClass('Selected');
}
}
SetSize();
$('.ResizeImages').click(function() {
SetSize(this);
});
});
我相信我正在使用的转换和转换应该在 Firefox 中工作,但不知道为什么不能。
在此先感谢,-
亚伦