Final tweaks for v1.5 and IE9

This commit is contained in:
Sam Potts
2016-01-16 13:02:04 +11:00
parent aed7db34ea
commit 891abd1d4a
9 changed files with 89 additions and 30 deletions

View File

@ -33,6 +33,18 @@ shr.setup({
buttons[i].addEventListener('click', newSource);
}
function toggleClass(element, className, state) {
if (element) {
if (element.classList) {
element.classList[state ? 'add' : 'remove'](className);
}
else {
var name = (' ' + element.className + ' ').replace(/\s+/g, ' ').replace(' ' + className + ' ', '');
element.className = name + (state ? ' ' + className : '');
}
}
}
// Set a new source
function newSource() {
var trigger = this,
@ -102,10 +114,10 @@ shr.setup({
}
for (var x = buttons.length - 1; x >= 0; x--) {
buttons[x].parentElement.classList.remove('active');
toggleClass(buttons[x].parentElement, 'active', false);
}
event.target.parentElement.classList.add('active');
toggleClass((event.target || event.srcElement).parentElement, 'active', true);
}
})();

View File

@ -2,6 +2,11 @@
// Examples
// ==========================================================================
section {
margin: 0 auto @padding-base;
max-width: @example-width-video;
}
video,
.plyr__video-embed {
border-radius: @border-radius-base;
@ -14,8 +19,7 @@ video,
// Example players
.plyr {
margin: 0 auto @padding-base;
max-width: @example-width-video;
margin: 0 auto;
&__controls {
border-radius: 0 0 @border-radius-base @border-radius-base;
@ -53,6 +57,7 @@ video,
// Style full supported player
.plyr__cite {
display: none;
margin-top: @padding-base;
.icon {
margin-right: (@padding-base / 4);