Elegant Scroll to Top - Back to top JavaScript plugin example – Colors: Button Background, Border, and Icon Colors
You can check out the code below to set the parameters.
Colors: Button Background, Border, and Icon Colors
Example code
<link rel="stylesheet" href="http://your-domain.com/elegant-scroll-to-top/css/elegant-scroll-to-top.min.css">
<script src="http://your-domain.com/elegant-scroll-to-top/js/elegant-scroll-to-top.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
var elegantScrollToTop = new ElegantScrollToTop({
bgColor: '#009688',
bgColorHover: '#008a7c',
bgColorFocus: '#008a7c',
bgColorActive: '#00756a',
borderColor: '#fff',
borderColorHover: '#bcdd98',
borderColorFocus: '#bcdd98',
borderColorActive: '#fff',
iconColor: '#fff',
iconColorHover: '#a4d071',
iconColorFocus: '#a4d071',
iconColorActive: '#bcdd98'
});
elegantScrollToTop.init();
});
</script>
Related options
Peoprty | Possible Values | Default Value | Description |
---|---|---|---|
bgColor | e.g. null, '#454545', '#369', '#000', '#fff', etc. | null | The background color of the button. |
bgColorHover | e.g. null, '#454545', '#369', '#000', '#fff', etc. | null | The background color of the button in hover state. |
bgColorFocus | e.g. null, '#454545', '#369', '#000', '#fff', etc. | null | The background color of the button in focus state. |
bgColorActive | e.g. null, '#454545', '#369', '#000', '#fff', etc. | null | The background color of the button in active state. |
borderColor | e.g. 'transparent', '#000', '#454545', '#fff', etc. | '#fff' | The border color of the button. |
borderColorHover | e.g. 'transparent', '#000', '#454545', '#fff', etc. | '#fff' | The border color of the button in hover state. |
borderColorFocus | e.g. 'transparent', '#000', '#454545', '#fff', etc. | '#fff' | The border color of the button in focus state. |
borderColorActive | e.g. 'transparent', '#000', '#454545', '#fff', etc. | '#fff' | The border color of the button in active state. |
iconColor | e.g. null, '#333', '#369', '#454545', '#fff', 'currentColor', etc. | null | The color of the icon. If you use a predefined icon (e.g. icon1, icon2, etc.), the color applies as a fill color. If you use the iconType parameter width 'custom' value, the color applies as a CSS color property. |
iconColorHover | e.g. null, '#333', '#369', '#454545', '#fff', 'currentColor', etc. | null | The color of the icon in hover state. If you use a predefined icon (e.g. icon1, icon2, etc.), the color applies as a fill color. If you use the iconType parameter width 'custom' value, the color applies as a CSS color property. |
iconColorFocus | e.g. null, '#333', '#369', '#454545', '#fff', 'currentColor', etc. | null | The color of the icon in focus state. If you use a predefined icon (e.g. icon1, icon2, etc.), the color applies as a fill color. If you use the iconType parameter width 'custom' value, the color applies as a CSS color property. |
iconColorActive | e.g. null, '#333', '#369', '#454545', '#fff', 'currentColor', etc. | null | The color of the icon in active state. If you use a predefined icon (e.g. icon1, icon2, etc.), the color applies as a fill color. If you use the iconType parameter width 'custom' value, the color applies as a CSS color property. |
Scroll down to view the Scroll to Top button
You can see it now