I have a cshtml page with some div elements. These div elements are colored with a gradient, as indicated in the style classes. I also added a hover class that turns the div color a little lighter, actually simulating the effect of a button and hovering above it. Ultimately, divs are used to hold text received from the MVC.
What I would like to do is somehow in jquery, perhaps to dynamically change the shading of a set of divs. I will indicate that the set will be red (# FF0000), but the rest of the div in the set should then light up. Something similar to the W3 hue block http://www.w3schools.com/tags/ref_colorpicker.asp
Here is jsfiddle with what I more or less need to do.
https://jsfiddle.net/ezxkf3qL/1/
You will notice that I have 2 css classes that define color gradients, 'red1' and 'red2'. If I have 6 sections in 3 sets, this means that I need to build 18 different classes of colors and the corresponding methods for pointing them.
Ideally, I would like to have one color class and one hover method class for each set. Then jquery will take a color and dynamically change the gradient colors of the "red" class for each element to get the same effect as in my example.
I also tried something:
var list = $("div.col").find(".get");
var step = 100;
list.each(function(i, e) {
var shade = i * step;
$(this).css("background-color", "rgb(255, " + shade + "," + shade + ")");
});
This changes the hue, but with 6 elements it becomes too light or does not distinguish between different shading. Also this does not solve my gradient problem.
. , jquery, , . .