Re-attach CSS to dropped draggable div
I have a bunch of divs which are 'draggable':
HTML
- <div id="a1" class="answerCard noselect">1</div>
- <div id="a2" class="answerCard noselect">2</div>
- <div id="a3" class="answerCard noselect">3</div>
- <div id="a4" class="answerCard noselect">4</div>
- <div id="a5" class="answerCard noselect">5</div>
CSS
- .answerCard {
- position: absolute;
- top: 0px;
- left: 0px;
- width: 150px;
- height: 150px;
- font-size: 120px;
- font-weight: 700;
- color: #fff;
- text-align: center;
- background-color: red;
- line-height: 150px;
- cursor: pointer;
- box-shadow: 10px 10px 25px #888888;
- z-index: 2;
- }
once a div is 'dropped', the 'box-shadow' is 'detached'. If the user decides they want to move the dropped div elsewhere how can I re-attach the 'box-shadow' to the div until it is dropped in another location, where it should again be detached?
jQuery
- $('.answerCard').draggable({
- stack: '.answerCard'
- });
- $('.dropLeft').droppable({
- drop: function(event, ui) {
- $(ui.draggable).detach().css({
- top: 0,
- left: 600,
- boxShadow: 'None'
- }).appendTo(this)
- }
- });
I've tried:
- .css({'box-shadow': '10px 10px 25px #888888'}).appendTo(this);
and
- $(ui.draggable).css({'box-shadow': '10px 10px 25px #888888'}).appendTo(this);
but without success... Is there any way to achieve this?