Monday, 30 September 2013

Toggling a absolute DIV is not working after firsttime

Toggling a absolute DIV is not working after firsttime

$('.pallete').hide();
$(document).delegate('.pick', 'click', function () {
var pos = $(this).offset();
var x = pos.left - $(window).scrollLeft() + $(this).width();
var y = pos.top - $(window).scrollTop() + $(this).height();
$('.pallete').css({
top: y + "px",
left: x + "px",
}).show();
});
$(document).delegate('.col', 'click', function () {
var pos = $(this).css('background-color');
$('.pick').css('background-color', pos);
$(this).parents('div').fadeOut();
});
Here is the fiddle, http://jsfiddle.net/zPNk3/5/. The problem is when I
click first time on .pick element the '.palette' element is shown
properly. But when I click next time the same is not working.

No comments:

Post a Comment