1. #1
    Sencha User
    Join Date
    Mar 2011
    Posts
    5
    Vote Rating
    0
    praviola is on a distinguished road

      0  

    Question dragrdrop example with img inside draggable element

    dragrdrop example with img inside draggable element


    Hello,
    I made a little change to dragrdrop demo by Sencha (in bundle with 'sencha-touch-1.1.0) and
    I did not succeed in making it work.

    The demo itself shows the basic technique for drag'n drop and let the user drag and drop a simple 'div' element.

    I simply added an image (html tag 'img') to the draggable 'div' and what happens is:

    when I drag the div clicking away from the img everything goes well; if I drag clicking on my img surface dragging occurs but when I release the mouse button the img does not detach from mouse pointer... ; I shall click again to trigger the drop.

    The trial I did was on PC with chrome browser.

    This is the code I changed inside index.html:

    <div id="draggable">Draggable<img src="myimg.png" height="35px" width="35px" /><p>hello</p></div>


    What was wrong? It do not know what event I should eventually catch and manage in order to make this simple demo work.

    Thank you,

    Paolo

  2. #2
    Sencha User tomalex0's Avatar
    Join Date
    Apr 2009
    Location
    San Jose, CA
    Posts
    589
    Vote Rating
    16
    tomalex0 will become famous soon enough

      0  

    Default


    Hi,

    The problem you mentioned only seems to happens in Desktop Browsers.


    You can try something like this to make it work


    HTML Code:
    <div id="draggable" style="z-index:1000;">Draggable<img  onmousedown="if (event.preventDefault) event.preventDefault()" src="icon.png" height="35px" width="35px" /><p>hello</p></div>

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    5
    Vote Rating
    0
    praviola is on a distinguished road

      0  

    Default


    Oh, I see...

    thank you a lot. I had better try the example on the device... Ill'do soon.

    Regards,
    Paolo

Similar Threads

  1. Replies: 1
    Last Post: 14 Jan 2011, 12:44 AM
  2. Draggable element is covered by other layer
    By su27 in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 14 Jul 2010, 2:36 PM
  3. Initialize a draggable element inside the rowbody of a grid
    By paquerette in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 12 May 2009, 12:17 AM
  4. Resizable and draggable element
    By cesarwbr in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 14 Aug 2008, 12:33 PM
  5. Replies: 0
    Last Post: 8 Nov 2007, 4:53 AM

Thread Participants: 1

Tags for this Thread