Toepassing van vendorprefixes voor het maken van animaties in LESS
Laten we een functie maken die de
cross-browser @keyframes opdracht implementeert:
.keyframes(@name, @code) {
@-o-keyframes @name {@code();}
@-moz-keyframes @name {@code();}
@-webkit-keyframes @name {@code();}
@keyframes @name {@code();}
}
Laten we onze functie gebruiken:
.keyframes(anim, {
from {
width: 100px;
}
to {
width: 200px;
}
}
);
Compilatieresultaat:
@-o-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@-moz-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@-webkit-keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}
@keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}