Opened 11 years ago

Closed 11 years ago

#3621 closed bug (notabug)

placeholder option problem with sortable elements

Reported by: chag Owned by:
Priority: major Milestone: 1.7
Component: ui.sortable Version: 1.6rc2
Keywords: Cc:
Blocked by: Blocking:

Description

The 'placeholder' option doesn't work as it should with sortable object. the placeholder styles do not overwrite the element style.

ex :

$(document).ready(function(){
	$(".news_elements").sortable({
		placeholder: "news_elements_empty", 
		revert: true 
	});
});

css :

.news_elements li {
	background-color: blue;
}

.news_elements_empty {
	background-color: red;
}

html :

<ul class="news_elements">
	<li>test1</li>
	<li>test2</li>
	<li>test3</li>
</ul>

When dragging the li, the empty place to drop it is not red. It's blue. But, if you don't defin a background on the LI, then, you'll see the blue one.

You can also try this with the actual last sortable demo on this page : http://dev.jquery.com/view/tags/ui/latest/demos/functional/#ui.sortable

Attachments (1)

sortable-ss.png (19.4 KB) - added by alan.castro 11 years ago.
firebug screenshot

Download all attachments as: .zip

Change History (4)

comment:1 Changed 11 years ago by Jörn Zaefferer

Component: ui.coreui.sortable
Milestone: TBD1.6

comment:2 Changed 11 years ago by alan.castro

I looked this issue and saw in firebug that the class .news_elements li overrides the news_elements_empty, so every li inside that ul is going to be blue it doesn't matter which class you put in the li element. I'm attaching a screenshot of firebug.

Changed 11 years ago by alan.castro

Attachment: sortable-ss.png added

firebug screenshot

comment:3 Changed 11 years ago by paul

Resolution: invalid
Status: newclosed

This is not a bug in jQuery UI - it's simply because your CSS for the placeholder is not specific enough, and therefore doesn't overwrite the default style. If you change the rule for the red background to ".news_elements .news_elements_empty", it'll work fine.

Note: See TracTickets for help on using tickets.