{"id":1702,"date":"2019-01-03T21:25:17","date_gmt":"2019-01-03T21:25:17","guid":{"rendered":"https:\/\/azoora.com\/blog\/?p=1702"},"modified":"2019-06-01T19:02:46","modified_gmt":"2019-06-01T19:02:46","slug":"background-color-morph-transition-between-background-colors-on-scroll","status":"publish","type":"post","link":"https:\/\/azoora.com\/blog\/javascript\/background-color-morph-transition-between-background-colors-on-scroll\/","title":{"rendered":"Background Color Morph: Transition Between Background Colors On Scroll"},"content":{"rendered":"\n<h3>Description:<\/h3>\n\n\n\n<p>Background Color Morph is a small (2kb minified) JavaScript library that applies a transition effect to background colors when scrolling down or up the webpage.<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3>How to use it:<\/h3>\n\n\n\n<p>Import the JavaScript&nbsp;<code>bg-color-morph.min.js<\/code>&nbsp;and Stylesheet&nbsp;<code>bg-color-morph.css<\/code>&nbsp;into the document.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>1<\/code><\/td><td><code>&lt;<\/code><code>link<\/code>&nbsp;<code>href<\/code><code>=<\/code><code>\"dist\/bg-color-morph.css\"<\/code>&nbsp;<code>rel<\/code><code>=<\/code><code>\"stylesheet\"<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>2<\/code><\/td><td><code>&lt;<\/code><code>script<\/code>&nbsp;<code>src<\/code><code>=<\/code><code>\"dist\/bg-color-morph.min.js\"<\/code><code>&gt;&lt;\/<\/code><code>script<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Add the required CSS class&nbsp;bg-morph to the target container.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>1<\/code><\/td><td><code>&lt;<\/code><code>section<\/code>&nbsp;<code>class<\/code><code>=<\/code><code>\"bg-morph\"<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>2<\/code><\/td><td><code>Content here<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>3<\/code><\/td><td><code>&lt;\/<\/code><code>section<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Set the start and end colors in hex.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>1<\/code><\/td><td><code>&lt;<\/code><code>section<\/code>&nbsp;<code>class<\/code><code>=<\/code><code>\"bg-morph\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>2<\/code><\/td><td><code>data-start-color<\/code><code>=<\/code><code>\"#f7b733\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>3<\/code><\/td><td><code>data-end-color<\/code><code>=<\/code><code>\"#fc4a1a\"<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>4<\/code><\/td><td><code>Content here<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>5<\/code><\/td><td><code>&lt;\/<\/code><code>section<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<p>Set the start\/end trigger points.<\/p>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>1<\/code><\/td><td><code>&lt;<\/code><code>section<\/code>&nbsp;<code>class<\/code><code>=<\/code><code>\"bg-morph\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>2<\/code><\/td><td><code>data-start-color<\/code><code>=<\/code><code>\"#f7b733\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>3<\/code><\/td><td><code>data-end-color<\/code><code>=<\/code><code>\"#fc4a1a\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>4<\/code><\/td><td><code>data-start-trigger<\/code><code>=<\/code><code>\"top\"<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>5<\/code><\/td><td><code>data-end-trigger<\/code><code>=<\/code><code>\"middle\"<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>6<\/code><\/td><td><code>Content here<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<table class=\"wp-block-table\"><tbody><tr><td><code>7<\/code><\/td><td><code>&lt;\/<\/code><code>section<\/code><code>&gt;<\/code><\/td><\/tr><\/tbody><\/table>\n\n\n\n<blockquote class=\"wp-block-quote\"><p><strong>Demo<\/strong>: <a href=\"https:\/\/www.cssscript.com\/demo\/transition-background-colors-scroll-morph\">Link<\/a><\/p><p><strong>Download<\/strong>: <a href=\"https:\/\/github.com\/awmiklovic\/BGColorMorph\/archive\/master.zip\">Github<\/a><\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Description: Background Color Morph is a small (2kb minified) JavaScript library that applies a transition effect to background colors when scrolling down or up the webpage.<\/p>\n","protected":false},"author":2,"featured_media":1718,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[12],"tags":[87],"jetpack_featured_media_url":"https:\/\/azoora.com\/blog\/wp-content\/uploads\/2019\/03\/Transition-Between-Background-Colors-On-Scroll-Background-Color-Morph.png","jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p7FQPL-rs","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/1702"}],"collection":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/comments?post=1702"}],"version-history":[{"count":1,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/1702\/revisions"}],"predecessor-version":[{"id":1719,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/posts\/1702\/revisions\/1719"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media\/1718"}],"wp:attachment":[{"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/media?parent=1702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/categories?post=1702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/azoora.com\/blog\/wp-json\/wp\/v2\/tags?post=1702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}