Hi guys and girls,
I was really looking forward to the new custom data attributes, because I wanted to implement this in Pro: https://codepen.io/Funsella/pen/dpRPYZ
I added the following to my child theme’s functions.php:
wp_enqueue_script( 'script', get_template_directory_uri() . '/js/inview.js', array ( 'jquery' ), 1.1, true);
(Side-Note: Despite the fact that the child theme is active, Pro looks for the script in the Pro theme folder, not in pro-child?? As a workaround, i created a /js/ folder in the pro directory and uploaded the script there. And can verify that it is loading, because i no longer get the error. But Pro refuses to load scripts from the child-theme folder)
Here’s the issue.
I am trying to run this on tristanarkesteijn.nl/test-color-change/
This page contains one section with the class ‘wrapper’. And three rows, to which I have added the custom attribute data-background-color with a HEX color code.
In addition, i changed the JS to:
jQuery(document).ready(function($){
var $target = $('.wrapper');
inView('.x-row').on('enter', function(el){
var color = $(el).attr('data-background-color');
$target.css('background-color', color );
});
});