<script>
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown1')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown2')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown3')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown4')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown5')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown6')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('image-dropdown7')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.download = filename;
a.click();
}
});
window.addEventListener('change', event => {
if (event.target.classList.contains('link-dropdown1')) {
const
selectedOption = event.target.querySelector('option:checked'),
imgUrl = selectedOption.dataset.imgUrl;
event.target.style.backgroundImage = `url(${imgUrl})`;
const
link = event.target.value,
filename = link.split('/').pop(),
a = document.createElement('a');
a.href = link;
a.click();
}
});
</script>