Created
April 1, 2017 15:30
-
-
Save AlekseyPn/2e45ad09aa1b060feb0aedbe692fe3bc 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
Как использовать Pixel Glass в своём проекте? | |
1. Установите пакет в папку с проектом через npm: | |
npm i pixel-glass --save-dev | |
2. Поместите макеты страниц в ваш проект в папку img (или в другую, какая вам нравится). | |
3. Добавьте этот код на вашу страницу в элемент <head>: | |
<!-- Pixel Glass --> | |
<style> | |
HTML { | |
background-repeat: no-repeat; | |
background-position: 50% 0; | |
/* По умолчанию показывается мобильный макет */ | |
background-image: url( "img/320.png" ); | |
} | |
/* Планшет */ | |
@media ( min-width: 760px ) { | |
HTML { | |
/* Планшетный макет */ | |
background-image: url( "img/760.png" ); | |
} | |
} | |
/* Десктоп */ | |
@media ( min-width: 960px ) { | |
HTML { | |
/* Десктопный макет */ | |
background-image: url( "img/960.png" ); | |
} | |
} | |
</style> | |
<link href="../node_modules/pixel-glass/styles.css" rel="stylesheet"> | |
<script src="../node_modules/pixel-glass/script.js"></script> | |
<!-- // Pixel Glass --> | |
Отредактируйте код под ваш проект: настройте медиавыражения, поменяйте адреса картинок на рабочие. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment