Jquery ui sortable placeholder cannot change background color

I can successfully change the color of the placeholder frame, but when I try to change the background color, nothing happens.

This jsfiddle code best explains this: http://jsfiddle.net/EUVrK/1/

+6
source share
3 answers

According to the JQuery UI Sortable Documentation, you can provide a css class for a placeholder. You should be able to specify the background in this class.

Using the placeholder property and forcePlaceholderSize, it works like a charm. I updated jsfiddle link

Hope this helps.

+8
source

I got some help from a friend on irc.freenode who suggested the following solution that does the trick.

ui.placeholder.css("visibility", "visible"); ui.placeholder.css("background-color", "red"); 

The background color of the placeholder was not shown because the actual item was not visible (I suppose it is hidden by default). Therefore, setting it to visible, you can see a different background color.

+2
source

CSS

  .placeholderBackground {background-color: # FD6FB7;}

PARAMETER

  $ ('. sortable'). sortable ({
 axis: 'y', placeholder: 'placeholderBackground'
 }). disableSelection ();
+2
source

Source: https://habr.com/ru/post/920679/


All Articles