Created
October 5, 2017 14:25
-
-
Save xmalinov/7f05cbe61e53e325a2e9b81109f80c6e to your computer and use it in GitHub Desktop.
Вставка адаптивной обложки
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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