#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0

    How to style the about to be dropped place in sortable?


    Hi to all!

    I have a table with sortable rows (using jqueryUI sortable) and i want to have a dashed border, or background image on the place where a dragged element is about to be dropped.


    Any ideas how i would go about achieving this? Only thing which comes to my mind is read the dragged element position, the other elements position and go from there somehow... but this seems complicated and maybe there is an easier way to do this.

    Would appreciate ideas very much.
  2. #2
  3. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Location
    Landan, England
    Posts
    743
    Rep Power
    165
    You likely need to investigate the droppable feature. That is, make elements droppable and, in their over callback, change the css of the element.

    Something like this:

    Code:
    $( ".selector" ).droppable({
        over: function( event, ui ) {
            $(this).css('border-style', 'dashed');
        }
    });
    Last edited by AndrewSW; January 1st, 2013 at 08:40 PM.
    "The mysql extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. Instead, either the mysqli or PDO_MySQL extension should be used." the docs
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    6
    Rep Power
    0
    ty

    upon further investigation it turns out there is a placeholder element which can be styled. problem solved

IMN logo majestic logo threadwatch logo seochat tools logo