I can successfully change the border colour of the placeholder, but when I try change the background colour, nothing happens.
This jsfiddle code best explains it: http://jsfiddle.net/EUVrK/1/
I can successfully change the border colour of the placeholder, but when I try change the background colour, nothing happens.
This jsfiddle code best explains it: http://jsfiddle.net/EUVrK/1/
According to the jQuery UI Sortable Documentation you can provide a css class for the placeholder. You should be able to specify the background in this class.
Using the placeholder and the forcePlaceholderSize property, it works like a charm. I've updated the jsfiddle link
Hope that helps.
I got some help from a friend on irc.freenode who suggested the following solution which does the trick.
ui.placeholder.css("visibility", "visible");
ui.placeholder.css("background-color", "red");
The background colour of the placeholder wasn't showing up because the actual element wasn't visible (I suppose it's set to hidden by default). So setting it to visible allows one to see the different background colour.
start
sortable event. start: (e, ui) => { ui.placeholder.css('visibility', 'visible'); ui.placeholder.css('background-color', 'red'); }
–
Drye CSS
.placeholderBackground{background-color:#FD6FB7;}PARAMETER
$('.sortable').sortable({ axis: 'y', placeholder: 'placeholderBackground' }).disableSelection();
With css
.ui-sortable-placeholder {
background-color: yellow;
visibility: visible !important;
}
© 2022 - 2024 — McMap. All rights reserved.