私はIEについて話していると知っていますが、はtransition
というより最近の(Edge?)バージョンで修正されています。IE/Edge CSS3トランジションがバックグラウンドポジションのプロパティで動作しない
...私は要素のbackground-position
を移行しようとしている(デモ下記参照)が、何らかの理由で、それはIEで働いていない: ' - (下のデモで
、 『私をクリックしてください』ボタンは隣接するテキストをハイライト表示する必要がありますが、IEではそうではありません
トグルdisplay:none
が再ペイントを強制しているため、「トグル表示」ボタンをトグルすると、背景色が表示されます私はbackground-size
がtransition
- 可能IEではないかもしれないが知っているが、background-position
の私の単一の移行プロパティに影響を与えますか?左側から右側への移行(IE以外のブラウザでもデモを見たい)
ありがとうございます!
/** JS only to facilitate the test and trigger the CSS on button click **/
var myHighlighter = document.querySelector('.button');
var myToggle = document.querySelector('.toggle');
myHighlighter.addEventListener('click', press)
// toggling `display:none` just forces a repaint
myToggle.addEventListener('click', toggle);
function press(e) {
var newState = (e.target.getAttribute('aria-pressed')!=="true");
e.target.setAttribute('aria-pressed', newState);
}
function toggle(e) {
var isToggled = (e.target.previousElementSibling.getAttribute('style'))
if (isToggled) {
e.target.previousElementSibling.removeAttribute('style');
} else {
e.target.previousElementSibling.setAttribute('style', 'display:none;');
}
}
/* conditional CSS for transition based on presence of `aria-pressed="true"` attribute */
.button + .text {
background: linear-gradient(to right, orange 50%, transparent 50%) no-repeat;
background-position:right bottom;
background-size: 200% 100%;
transition: none;
}
.button[aria-pressed="true"] + .text {
background-position: left bottom;
transition: background-position .5s linear;
}
<div class="wrapper">
<button type="button"
class="button"
aria-pressed="false">
Click Me
</button>
<span class="text">IE won't transition the background-position (color highlighting) initially without toggleing the display (repaint)</span>
<button class="toggle">Toggle Display</button>
</div>
どのバージョンのIEですか?遷移はIE <10では動作しません。 – Rob