Is it possible to pick colors from an iframe using some kind of eyedropper in JavaScript or jQuery? Both the page (that contains iframe) and iframe are on the same domain. Thanks for any ideas.
| SitePoint Sponsor |


Is it possible to pick colors from an iframe using some kind of eyedropper in JavaScript or jQuery? Both the page (that contains iframe) and iframe are on the same domain. Thanks for any ideas.

Hi,
Sure it's possible.
I've thrown together a little example here: http://hibbard.eu/blog/pages/iframe-color-picker/
I've used sstrudeau's jquery-dropper plugin to implement the eye-dropper.
I've then taken his basic demo, stuck the images etc within an iframe and tweaked the code a little.
If you have a look at the page source, you should be able to see what's going on.
If you have any questions, just let me know.
If it helps, I can also send you the files.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog



Glad you like it
It was just a demo to answer your original question of whether this is possible.
If you can find a colour-picker (eye-dropper??) that allows you to pick colours from anywhere on the page, I can help you implement it in an iframe.
How well do you know your JavaScript from your jQuery?
Check out SitePoint's latest JavaScript challenge
My blog


Bookmarks