0

I have a div that follows the mouse pointer and I would like that div to change its color with a complementary color, according to the color underneath it. So it needs to measure the color of whatever is undernith the mouse at any point and assign the complementary color to the div that follows the mouse pointer. Something like Gpick is doing: https://www.youtube.com/watch?v=oy7_PadJ1Ig

freestack
  • 21
  • 4
  • 5
    please show the things you've done so far. – guradio Oct 13 '15 at 09:23
  • @Pekka I'm trying to learn these things, but until now I could only make the div follow the mouse pointer and position it under the mouse pointer. `jQuery(document).mousemove(function(e){ var px =e.pageX-122; var py =e.pageY-70; jQuery(".nav-trigger-fl").css({left:px+ "px", top:py+"px"}); });` – freestack Oct 13 '15 at 09:34

1 Answers1

0

I have created demo example you can check here

$("div").mousemove(function(e){
  $('.follow').css({'top': e.clientY - 20, 'left': e.clientX - 20});
});
$("div").mouseover(function() {
   var col=$(this).css("background-color");
   $("#myid").css("background-color",col);

});

Click on this to see Demo

Allen
  • 319
  • 2
  • 9
  • Thanks, it's a good start, but I think I need something more complicated. I found something related, here: https://stackoverflow.com/questions/1936021/javascript-eyedropper-tell-color-of-pixel-under-mouse-cursor – freestack Oct 13 '15 at 13:10