I am creating a js file that creates a touch effect when I click on an object. I want to assign a class to an element in html code, which is just a color code, for example # f6ac32, and then create a function in Javascript / jQuery that can select that color code and create a variable from it, which I can use later (to change ripple effect color). Is it possible?
Here is what I did (see the comment in $ ('. Ripple'). Mousedown (function)):
$(document).ready(function() { var rplObj, x, y, ink, color, rplDelTimer;
div { background: #199ee3; width: 300px; height: 100px; } .ripple { position: relative; overflow: hidden; } .ink { position: absolute; border-radius: 100%; opacity: .4; transform: scale(0); -moz-transition: all 1s ease; -o-transition: all 1s ease; -webkit-transition: all 1s ease; transition: all 1s ease; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="ripple"></div> <p>Click the rectangle!</p>
Also, if you're interested, here is the site that I use for
source share