Rencontre ChtiJS #4
if ($(window).width() >= 640) {
//desktop
} else {
//mobile
}
breakpoint.scss
// Media Queries
$small-screen: 641px;
$medium-screen: 1280px;
$large-screen: 1440px
$screen: "only screen";
$small: "only screen and (min-width: #{$small-screen})";
$medium: "only screen and (min-width:#{$medium-screen})";
$large: "only screen and (min-width:#{$large-screen})";
$landscape: "only screen and (orientation: landscape)";
$portrait: "only screen and (orientation: portrait)";
breakpoint.css
@media only screen and (min-width: 641px) {
...
}
breakpoint.scss
#media-query--name:after{
content: "salameche";
}
@media #{$small} {
#media-query--name:after{
content: "reptincel";
}
}
@media #{$medium} {
#media-query--name:after{
content: "dracaufeu";
}
window
.getComputedStyle('#media-query--name',':after')
.getPropertyValue('content');
if (pokemon == 'salameche') {
alert("Je suis le pokemon " + pokemon + " correspondant à un smartphone");
};
if (pokemon == 'reptincel') {
alert("Je suis le pokemon " + pokemon + " correspondant à une tablette");
};
if (pokemon == 'dracaufeu') {
alert("Je suis le pokemon " + pokemon + " correspondant à PC");
};