Thanks for responding.
I need to do this dynamically.
My users will be changing the colors of their own elements.
I can put in values in classes, but I don't want to hard code the
gradient in the classes.
I tested the following and it works:
$('#button1').style.background="-webkit-gradient(linear, left top,
left bottom, from(#" + startHex + "), to(#" + endHex + "))";
I'll get the hex values using a color picker.
-Roberto
On Jan 23, 4:13 pm, Tony Thomas <truet...@gmail.com> wrote:
> Yes. I suggest looking into JQuery <http://jquery.com/>.
>
> What I would do is define a CSS class with the gradient and then use
> JQuery's addClass() <http://api.jquery.com/addClass/> method to add the
> class on some event such as a click <http://api.jquery.com/click/>. The
> code would look something like this:
>
> $('selector <http://api.jquery.com/category/selectors/>
> ').click().addClass('css-gradient-class');
>
>
>
>
>
>
>
> On Mon, Jan 23, 2012 at 7:58 AM, Roberto <rcaha...@gmail.com> wrote:
> > Is it possible to do this dynamically in javascript?
>
> > background: -webkit-gradient(linear, left top, left bottom,
> > from(#55aaee), to(#003366));
>
> > I want to be able to code in the from and the to dynamically.
>
> > There's so much to learn about CSS!
>
> > -Roberto
>
> > --
> > --
> > You received this because you are subscribed to the "Design the Web with
> > CSS" at Google groups.
> > To post: css-design@googlegroups.com
> > To unsubscribe: css-design-unsubscribe@googlegroups.com
--
--
You received this because you are subscribed to the "Design the Web with CSS" at Google groups.
To post: css-design@googlegroups.com
To unsubscribe: css-design-unsubscribe@googlegroups.com
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.