วันอังคารที่ 22 สิงหาคม พ.ศ. 2560

[CSS][Javascript] Basic adjusting page for responsive website

There are basically 2 methods to perform.

1.) CSS way

<style>
body {
    background-color: lightblue;
}
@media screen and (max-width: 480px) {
    body {
        background-color: lightgreen;
    }
}
</style>

2.) Javascript way

<script>
$(document).ready(function () {
/* detect window size to toggle menu */
if ($(window).width()<768)
{
isClosed = false;
$('.hamburger').toggleClass('is-open');
$('.hamburger').toggleClass('is-closed');
$('#wrapper').toggleClass('toggled');
}
});
</script>

This is just a snippet code for example.

パチンコ