[Pro] Best Way to Approach Multiple Rollovers

Walter - how would you go about adding the Hex value to the colour name on the swatch ie Alice Blue #F0F8FF

I see caption.update(elm.retrieve(‘caption’)); but cant seem to get the colour value in there.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You would do that in the “database” array:

...
{'f0f8ff': 'Alice Blue #F0F8FF'},
…

Whatever you add in the value part of the object will become the caption, while the key will become the background color.

Walter

On Nov 19, 2012, at 4:22 PM, DeltaDave wrote:

Walter - how would you go about adding the Hex value to the colour name on the swatch ie Alice Blue #F0F8FF

I see caption.update(elm.retrieve(‘caption’)); but cant seem to get the colour value in there.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I thought you could maybe pull it from the JS using something like elm.retrieve(‘caption’ + ‘background-color’) or create a new variable first from the bg color and then include the variable.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You could, but I wanted to keep the logic simple in the JavaScript.

The database holds matched pairs of colors and captions. Whatever you put in the database is shown on the page.

Now if you already had your database populated, you could use find-and-replace in TextMate/TextWrangler/BBEdit to automatically update the caption with the color value.

Or you could hack the script with something like swatch.store('caption', $H(color).values().first() + ' #' + $H(color).keys().first()); up in the colors.each() block. That would keep you from having to edit the database if you didn’t want to do that, at the expense of making the example less clear.

Walter

On Nov 19, 2012, at 4:33 PM, DeltaDave wrote:

I thought you could maybe pull it from the JS using something like elm.retrieve(‘caption’ + ‘background-color’) or create a new variable first from the bg color and then include the variable.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I wanted to keep the logic simple in the JavaScript

Understood - I was really just fiddling to try a bit of enhancement.

I will fiddle some more.

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

That worked.

My thinking was to create a page that has all those common colours with their Hex values that I can use for my own reference.

Done!


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

This appears to have worked out really well. One of the benefits of holding the colours in an object like this is that you could sort the image swatches based on name, hue, tone, popularity or any other variables.
Regards,
Tim.

Experienced Freeway designer for hire - http://www.freewayactions.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And nobody has tried to spot the difference? I’ll give you a hint: “quantity of anonymous functions”.

Walter

On Nov 18, 2012, at 3:24 PM, Walter Lee Davis wrote:

Bonus points for anyone who can tell me what the difference is, and why it matters.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

And nobody has tried to spot the difference?

Oh we have seen the differences but need your superior intellect to make sense of them!

:wink:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Pshaw!

In my first attempt at this, I created the click observer within in the mouseover observer that showed the popup. What this meant was that each time the mouseover fired, a new handler was created for the click event, which was a waste. Changing it the way I did in the second example put a single click handler on the popup at the beginning of the page load, and never varied it. The only thing that changed was the address – the value of the go variable. By not creating a new handler at each show of the popup, the whole script runs quite a lot faster and that makes the page run better over time. (It also won’t leak a bunch of memory in IE < 10.)

Walter

On Nov 21, 2012, at 12:23 PM, DeltaDave wrote:

And nobody has tried to spot the difference?

Oh we have seen the differences but need your superior intellect to make sense of them!

:wink:


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options