Sponser Link
Sponser Link
目次
参考サイト
https://fit-jp.com/bgswitcher/
Sponser Link
HTML
HTML
<div class="bg-slider">
<h1 class="bg-slider__title">BGSWITCHER DEMO PAGE</h1>
</div>
Sponser Link
CSS
CSS
.bg-slider {
width: 100vw;
height: 100vh;
background-position:center center;
background-size: cover;
display: flex;
align-items: center;
justify-content: center;
}
.bg-slider__title{
color: #fff;
font-size: 48px;
line-height: 1.5;
font-weight: bold;
text-align:center;
text-shadow: 1px 1px 1px #000;
}
Sponser Link
JS
JS
<script src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script src="js/jquery.bgswitcher.js"></script>
<script>
jQuery(function($) {
$('.bg-slider').bgSwitcher({
images: ['img/bg1.jpg','img/bg2.jpg','img/bg3.jpg'], // 切り替える背景画像を指定
});
});
</script>
Sponser Link