Skip to content

Instantly share code, notes, and snippets.

@xmalinov
Created October 5, 2017 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xmalinov/7f05cbe61e53e325a2e9b81109f80c6e to your computer and use it in GitHub Desktop.
Save xmalinov/7f05cbe61e53e325a2e9b81109f80c6e to your computer and use it in GitHub Desktop.
Вставка адаптивной обложки
<script>
$('.s .page-content .content').css({
'display': 'none' // Поставить 'block' если под шапкой есть текстовый блок (как в продуктах)
})
$('.s .cover-image').css({
'height': '240px',
'min-height': '150px'
})
$('.s .cover-image img').css({
'display': 'none'
})
function setCover() {
var w = 480
if (window.innerWidth < w) {
// Вставить url изображения для мобильной версии
$('.s .cover-image').css({
'background-image': 'url(https://b2b-qa.pmclub.me/documents/20182/59245/parliament-cover-mobile.png)'
})
$('.s .page-content').css({
'padding': '0 10px'
})
$('.s .page-content .cover .back').css({
'top': '0'
})
} else {
// Вставить url изображения для десктопной версии
$('.s .cover-image').css({
'background-image': 'url(https://b2b-qa.pmclub.me/documents/20182/59245/parliament-cover-desktop.png)'
})
$('.s .page-content .cover .back').css({
'top': '15px'
})
}
}
setCover()
$(window).resize(function() {
setCover()
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment