jQuery(function ($) {
var topBtn = $('#cta');
topBtn.hide();
$(window).scroll(function () {
var scrollTop = $(this).scrollTop();
if (window.matchMedia('(max-width: 480px)').matches) {
// 480px 以下の場合
if (scrollTop > 150) {
topBtn.fadeIn();
} else {
topBtn.fadeOut();
}
} else {
// 480px より大きい場合
if (scrollTop > 300) {
topBtn.fadeIn();
} else {
topBtn.fadeOut();
}
}
});
});#cta {
position: fixed;
bottom: 0;
right: 0;
z-index: 999;
}ID#ではなくてもclass.でも可
