スクロールヒントのアイコンをカスタマイズ~スタイルシートCSSジェネレーター~
(スマホ横スライドできます)
(注)■は、CSSの項目で、■は、スクロールヒント起動javascriptの項目です
本ページの「スマホスクロールヒントのアイコンなどをカスタマイズ」は、ScrollHintサイトが提供するCSSライブラリーを使用しています。 https://appleple.github.io/scroll-hint/ (ScrollHint MIT License Copyright (c) 2018 Hori Godai)
下タブメニューの「スクロールヒントCSSコード」は、上の操作パネルのフォームで変更した結果(「変更&表示」ボタンクリック)が反映されています。
上操作パネルのフォームで変更した結果は、下の「スクロールヒントHTML、javascript」のコードを編集しHTMLコードを完成させると、
そのデモを見ることができます。
スクロールヒント完成デモ例>>デモ
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- (1) スクロールヒントCSS -->
<style>
// ここに、左のスクロールヒントCSSを配置
@keyframes scroll-hint-appear {
0% {
transform: translateX(40px);
opacity: 0;
}
10% {
opacity: 1;
}
50%,
100% {
transform: translateX(-40px);
opacity: 0;
}
}
.scroll-hint.is-right-scrollable {
background: linear-gradient(270deg, rgba(0, 0, 0, .15) 0, rgba(0, 0, 0, 0) 16px, rgba(0, 0, 0, 0));
}
.scroll-hint.is-right-scrollable.is-left-scrollable {
background: linear-gradient(90deg, rgba(0, 0, 0, .15) 0, rgba(0, 0, 0, 0) 16px, rgba(0, 0, 0, 0)), linear-gradient(270deg, rgba(0, 0, 0, .15) 0, rgba(0, 0, 0, 0) 16px, rgba(0, 0, 0, 0));
}
.scroll-hint.is-left-scrollable {
background: linear-gradient(90deg, rgba(0, 0, 0, .15) 0, rgba(0, 0, 0, 0) 16px, rgba(0, 0, 0, 0));
}
.scroll-hint-icon {
position: absolute;
top: calc(50% - 25px);
left: calc(50% - 60px);
box-sizing: border-box;
width: 120px;
height: 80px;
border-radius: 5px;
transition: opacity .3s;
opacity: 0;
background: rgba(255, 255, 255, 0.87);
text-align: center;
padding: 20px 10px 10px 10px;
} /*4*/
.scroll-hint-icon-wrap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
max-height: 100%;
pointer-events: none;
}
.scroll-hint-text {
font-size: 8px;
color: #141414;
margin-top: 5px;
} /*6*/
.scroll-hint-icon-wrap.is-active .scroll-hint-icon {
opacity: .8;
}
.scroll-hint-icon:before {
display: inline-block;
width: 40px;
height: 40px;
color: #FFF;
vertical-align: middle;
text-align: center;
content: "";
background-size: contain;
background-position: center center;
background-repeat: no-repeat;
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAwCAYAAACFUvPfAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAABSawAAUmsB1S1ZEQAABSNJREFUaN7N2XmoVVUUBvDfue/lS02tfGkD2UA2zzTQYCVEUdA8EUWj0jMNaSKI5igqIor+SFGLaKAoLSowaB6NioposLLMRtPXYIU53tMfa988T17v3e49N1xwedz99l372+us9a1v75Mp2bq7xsvzLMuy6gQcjAlY0jllemlrVMoGDQOy33JsguNxArnurvHrLujOKdOsNBSm40tcTLYF+boLGrI8g+9xK7bDJJlKd9e4Uvy39/XPtMgQbOw/hCpfM/VtvIzxcrPxastBJzsZN6PagP8qnkMHzpPnr3dfMK7aObW5oqwH9Hw8pbGkzDEsrTNXJauWkdpZ8y56t5RaO+IZ/IAT0V0G9dUT6UYBD8Bl6MQkdJcVofZYZLwV1aUGVAZ2Ymn6aCQqBYY4DKdiJl6A4T39VdKGNsSv+FmddZMoL68Bvhe3Yf1Go5CjKqvgSCzEHVi5VgAG4xq8gtcFw1yKQXWBLkTmrLTQ/EolW9ZMvVTk1bT5M/BxL5VzNq7AYtGEfsMNOKke/1kCvStm41OcomStsJZtJGhwuSjOn7BtWv/zNLay76BEwXQJarq7xYAJRtkezybABLv8mDbULzm0i+ZxJl7DSJzbQLut4BPMqWPDB6BN5HLNRmIbkePL6wF9Wn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P7mtQqcdOo7S8OwH1eRLY8wf+jvSsY5+u+Jv0NrzdKXFOX9L0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTgtMDQtMDRUMTc6MDY6MTkrMDI6MDDgOiIFAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE4LTA0LTA0VDE3OjA2OjE5KzAyOjAwkWeauQAAAEZ0RVh0c29mdHdhcmUASW1hZ2VNYWdpY2sgNi43LjgtOSAyMDE2LTA2LTE2IFExNiBodHRwOi8vd3d3LmltYWdlbWFnaWNrLm9yZ+a/NLYAAAAYdEVYdFRodW1iOjpEb2N1bWVudDo6UGFnZXMAMaf/uy8AAAAYdEVYdFRodW1iOjpJbWFnZTo6aGVpZ2h0ADUwODkeiA4AAAAXdEVYdFRodW1iOjpJbWFnZTo6V2lkdGgANDg2yxEWuwAAABl0RVh0VGh1bWI6Ok1pbWV0eXBlAGltYWdlL3BuZz+yVk4AAAAXdEVYdFRodW1iOjpNVGltZQAxNTIyODU0Mzc5cTJfggAAABN0RVh0VGh1bWI6OlNpemUAMTYuMktCQu494S8AAABHdEVYdFRodW1iOjpVUkkAZmlsZTovLy4vdXBsb2Fkcy81Ni9jWHo5U1lOLzE0MTQvaG9yaXpvbnRhbC1zY3JvbGxfOTc1NzEucG5nTbn0vAAAAABJRU5ErkJggg==);
} /*8*/
.scroll-hint-icon:after {
content: "";
width: 34px;
height: 14px;
display: block;
position: absolute;
top: 10px;
left: 50%;
margin-left: -20px;
background-repeat: no-repeat;
background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAEALAAAAAABAAEAAAgEAAMEBAA7);
opacity: 0;
transition-delay: 2.4s;
} /*9*/
.scroll-hint-icon-wrap.is-active .scroll-hint-icon:after {
opacity: 1;
}
.scroll-hint-icon-wrap.is-active .scroll-hint-icon:before {
animation: scroll-hint-appear 1.2s linear;
animation-iteration-count: 2;
}
.scroll-hint-icon-white {
background-color: #FFF;
box-shadow: 0 4px 5px rgba(0, 0, 0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hint-text {
color: #000;
}
</style>
</head>
<body>
<h3>スクロールヒント デモ</h3>
<!-- (2) スクロールヒント表示域 -->
<div class="js-scrollable" style="width:400px; height:350px; background:#dcdcdc;overflow:auto">
<img src="img/hibiya20101204005.jpg">
</div>
<span><small>2021.1.14</small></span>
<!-- (3) スクロールヒントjavascriptライブラリー -->
<script src="https://unpkg.com/scroll-hint@latest/js/scroll-hint.min.js"></script>
<!-- (4) スクロールヒント表示javascript関数 -->
<script>
new ScrollHint('.js-scrollable', {
remainingTime: 8000, // スクロールヒントの表示時間(ms ミリセカンド)。例は8秒。
//scrollHintIconAppendClass: 'scroll-hint-icon-white', // スクロールヒント背景色を白色にするとき。
i18n: {
scrollable: 'スクロールできます' //スクロールヒントメッセージ
}
});
</script>
</body>
</html>
最終更新日:2019.11.19(初版),2021.1.14 |
メール mailto: | 掲示板 |
画像を
dataURL Scheme
(base64文字列)に変換
size:WidthxHight