views:

234

answers:

2

I'm using JQuery's Sortable (not Draggable or Droppable) and I was wondering how I could highlight the potential drop areas (using CSS) that a user has when the user has begun sorting. Something like

http://www.shopdev.co.uk/blog/sortables.html

but with highlighting the area in which the item can be dropped.

Thank you!

+2  A: 

I might be misunderstanding but is the "drop placeholder" demo what you're looking for?

http://jqueryui.com/demos/sortable/#placeholder

Andy Gaskell
A: 

Use the Placeholder option to define a css class to apply to the default white space

  placeholder: 'someClass'

Demo here

You can also use the change event and override the inline visibility hidden that the sortable applies to the placeholder.

See quick demo here

$("#sortable").sortable({
    change: function(event, ui) {
      ui.placeholder.css({visibility: 'visible', border : '1px solid yellow'});
    }
});
redsquare
Both of you were helpful, but your answer was more in-depth and helpful. Thank you once again - sometimes the simplest answers are the hardest to see.
Rio