﻿var previousItem; $(function () { captchaSetup() }); function captchaSetup() { $(".draggables").draggable({ snap: "#iconContainer", snapMode: "inner", snapTolerance: 5, revert: false, containment: "#draggableArea", start: function () { resetPreviousItem($(this)) } }); $("#iconContainer").droppable({ drop: function (a, b) { $("#captchaValue").val(b.draggable.attr("alt")); $("#captchaValue").next("div.bubble").animate({ opacity: "hide" }, "slow") } }) } function resetPreviousItem(a) { $("#captchaValue").val(""); if ($("#captchaValue").parent().attr("class") != "bubbleholder") { $("#captchaValue").parent().wrapInner("<div class='bubbleholder'></div>"); $("#captchaValue").after("<div class='bubble'><div>Drop here</div></div>") } $("#captchaValue").next("div.bubble").css("right", "39px"); $("#captchaValue").next("div.bubble").css("top", "8px"); $("#captchaValue").next("div.bubble").animate({ opacity: "show" }, "slow") };
