Jump to content
Search Community

jaumemiralles

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by jaumemiralles

  1. At the end i'm taking Blake's option... in fact is what i used to have. All this came because i wanted my code in a way that Draggables where persistent and all the callbacks and functionalities where inside the instance, not mixing Draggable's callbacks and 'traditional' eventlisteners for javascript. In that case i could have cleanner code and instances ready to use. For what we have been commenting, i see it was not your original idea and greensock designed draggable just for that, and not handling different behaviors. So i'm using draggable just for drag, creating and killing it just for the case i'm dragging, as Blake suggested, and everything works fine. Thanks to all for your patience and the nice tips
  2. I'll try to explain in points: - For me is a typical case that you want to drag&drop a list in some cases, and keep it fixed and ready to click and do things on it in other cases... maybe there is an easier way and i'm complicating everything - I got it when i used the custom attribute data-clickable="true" for the whole target of the draggable instance. Thus, when it's true it's not draggable, and viceversa... perfect - My problem now is that i realize that when data-clickable="true"... click and release callbacks in Draggable instance are disabled, while press is not... and i need the 3, and "data-clickable=true" might seem "yes, you can click it" .... really, i don't understand why, what's the point in this, and why it's so dificult something like "disable/enable dragging on custom action"
  3. OSUblake, again same doubt comes to me. You show me a constructor, nothing about adding eventlisteners after creating instance. I see in docs we have 'addeventlistener' but no info about 'remove', should i supose it's the same way as in plain javascript?
  4. Jonathan, Ok, we have dragClickables attribute... but i can't find in documentation which is the method to change attributes... it seems attribute can only be set on create
  5. You won't believe... at the end i decided to cut code in a savage manner and see what happens in order to trap the problematic line, it took me time. One of my functions was named "com()" and somehow that was interfering with the internal "com" gsap is using in its code. Renaming the function made all to work again smoothly and the messing error just dissapeared. It seems like a bug on scope matters... but you will know better than me Thanks, sir
  6. I did. I made the basic codepen, not calling your scripts, and it works: http://codepen.io/anon/pen/jAvJPq I made an awful codepen with the whole code, with the call to your scripts, and it gives the error. I prefer not to show that link in public. Can it be any change on the scripts i'm calling? What do you mean with 'Object.prototype' ?
  7. I'll keep checking and prepare a codepen if necessary. By the way i was in FF, now i trieb chrome and the result is: Uncaught TypeError: Cannot read property 'plugins' of undefinedSa @ Draggable.min.js:14Sa.create @ Draggable.min.js:15makeElementTouchDraggable @ mb-i2-draft.jsp?idDraft=27:1004enableDnDBehavior @ mb-i2-draft.jsp?idDraft=27:978setMode @ mb-i2-draft.jsp?idDraft=27:432doubleClick @ mb-i2-draft.jsp?idDraft=27:791g._callback @ TweenMax.min.js:16g.render @ TweenMax.min.js:17g.render @ TweenMax.min.js:16C._updateRoot.F.render @ TweenMax.min.js:17g.dispatchEvent @ TweenMax.min.js:16r @ TweenMax.min.js:16
  8. Hi, great work and thaks in advance In my code i'm just creating a Draggable instance, where 'element', is a div tag that i checked is not null and has an id and a classname. In return i get an strange error message in navigator console as 'TypeError: q.com.greensock is undefined' The odd thing is that i didn't any changes and it was working fine all the time. I'm getting scripts via http, so they are not stored in my machine, maybe something changed? function makeElementTouchDraggable(element) { console.log("touch-drag id="+element.id); var d = Draggable.create(element, { type:"y", bounds: list_notes_element, onPress:function() { }, onRelease:function() { }, onClick:function(event) { }, onDragStart:function() { dragStart(this.target); }, onDrag:function(event) { dragging(this); }, onDragEnd:function(e) { endingDrag(this); } }); currentDraggable=d[0]; }
  9. Hi, first of all, nice job, really! I've tried to get the info on forums and i wasn't lucky or didn't understand correctly, any help will be appreciated. I'm trying to use drag and click callbacks on Draggable instances. In fact it works pretty well. The problem is that i want the instances to be clickable OR draggable. I don't want instances to be draggable until my app is in the correct context. I know there is a method like disable()... but that would disable the whole instance and i just want to dissable one callback. I know i could use native clickable, but i would prefer to keep al my events in a gsap code. Creatting/killing draggable instances while on native clicks looks ugly I know i could put an if(condition) inside my 'onDrag' callback... but that wouldn't stop the drag action itself. What do you thing would be the best approach? I see this case is a typical situation in web environment, but it seems like "Draggable" instances are all callbacks or noting... or i am wrong Thank you in advance
×
×
  • Create New...