Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Draggable Boxes with CSS3

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #44732
    Elandry
    Member

    Hi all,

    I’ve seen some java libraries for creating draggable boxes; as in you can click and drag the items around the screen.

    I’m working on finishing up my website for my Digital Media class and all of these codes are pretty complicated for a beginning class and I cannot use code libraries so my question is:

    Is there some way of using CSS3 or very simple java (as in least amount of code possible) to create draggable boxes?

    Thanks for reading and any responses or advice.

    #134871
    unasAquila
    Participant

    html5 has native drag (all latest browsers support it)

    draggable has 7 events which are

    * dragstart
    * drag
    * dragenter
    * dragleave
    * dragover
    * drop
    * dragend

    here is a quick codepen to show a quick sample
    [drag](http://codepen.io/anon/pen/gdHAv)

    #134878
    Elandry
    Member

    When I try to drop that picture it snaps back, anyway to make it stay where it’s dropped?

    #134880
    unasAquila
    Participant
    #134881
    Elandry
    Member

    I suppose that is drag and drop but is there anyway to modify the java so that it can be dropped anywhere the user chooses to, or maybe increasing the area of where it can be dropped?

    Thanks so much for your help BTW.

    #134883
    unasAquila
    Participant

    yes there is using the events

    * dragstart
    * drag
    * dragenter
    * dragleave
    * dragover
    * drop
    * dragend

    and css.

    Obviously i can only lead you in the right direction you will need to do the rest.

    offtopic – it’s Javascript not Java

    #134884
    Elandry
    Member

    Okay, I’ll look into them thanks a bunch.

    Doh! That’s what I meant..

    #134887
    unasAquila
    Participant

    I understood you exactly :D

    What exactly is the project parameters.

    #134888
    Kitty Giraudel
    Participant

    HTML5 drag’n’drop API is to a point where I’d rather use JavaScript to do such a thing. My two cents. :)

    #134890
    unasAquila
    Participant

    here is an example which can be dropped anywhere.

    [drop it](http://codepen.io/anon/pen/AIekK)

    but it may be more than you need.

    #134913
    Elandry
    Member

    That’s exactly what I’m looking for. Basically my website is a Windows 95 themed desktop and I will be putting all information and projects into these movable boxes to make it more interactive.

    Question:

    I need to use this for multiple items per page, how can I make this work in the javascript for a class rather than an id?

    #134920
    unasAquila
    Participant
    #134926
    unasAquila
    Participant

    I forked it and came up with this [Forked](http://codepen.io/anon/pen/IjrDs)

    #134935
    Elandry
    Member

    Is there a reason why in both Dreamweaver and my browser (Chrome and IE) that it won’t enable the drop?

    I’ve tried the tutorials and the example code where it works in codepen but when put into Dreamweaver it will only showing you dragging it around but won’t allow it to be dropped anywhere, even though the code is the same.

    #134937
    Paulie_D
    Member

    Pretty certain that the version of webkit in DW is just the basic stock version and won’t support that HTML feature.

    As for Chrome & IE, it will depend on your version and whether they have that feature implemented.

Viewing 15 posts - 1 through 15 (of 17 total)
  • The forum ‘CSS’ is closed to new topics and replies.