[Proto-Scripty] Re: 'hoverclass' option for draggables?
Here, this kind of works. The problem is, there's no way to tell when the hover is finished. I tried clearing the 'dark' class name in the onDrag callback of the draggable but it overrides setting it in the onHover. You could probably do some timer trickery, but it all ends up being less than elegant. Drag Me new Draggable('sampleDrag',{onDrag:function(){},onStart:function(){$ ('sampleDrag').addClassName('hovering')},onEnd:function(){$ ('sampleDrag').removeClassName('hovering')}}) Droppables.add('sampleDrop', { accept: 'draggy',onHover: function() {funkyHover()}}) function funkyHover() { hovers = document.body.select('.draggy') if(!hovers[0].hasClassName('dark')) { hovers[0].addClassName('dark') } } On Oct 3, 11:43 am, lfortin <[EMAIL PROTECTED]> wrote: > Thanks for your reply. > > The required condition is that the draggable is being moved over a > droppable which can accept the draggable. > > In fact, the same behavior as the droppable 'hoverclass' option, but > add the css class to the draggable instead of the droppable. > > Is it possible? > > On Oct 3, 11:26 am, Diodeus <[EMAIL PROTECTED]> wrote: > > > I'm not sure that answered your question. > > > What conditions are required for the hover? > > > On Oct 3, 11:10 am, Diodeus <[EMAIL PROTECTED]> wrote: > > > > onDrag runs continuously as you drag the item. Use onStart and onEnd. > > > > Like this: > > > > new Draggable('sample',{onStart:function(){$ > > > ('sample').addClassName('dark')},onEnd:function(){$ > > > ('sample').removeClassName('dark')}}) > > > > On Oct 3, 10:16 am, lfortin <[EMAIL PROTECTED]> wrote: > > > > > With the Droppable class, there is an option 'hoverclass', which > > > > allows us to temporarily add a css class when an acceptable draggable > > > > is hovering it. > > > > > I was wondering if such an option exists for the Draggable class? To > > > > add a css class to the draggable instead of the droppable in this > > > > case? > > > > > If it does not exists, do you have a suggestion on how to do it using > > > > the onDrag callback? > > > > > Thanks in advance, > > > > > -Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: 'hoverclass' option for draggables?
Thanks for your reply. The required condition is that the draggable is being moved over a droppable which can accept the draggable. In fact, the same behavior as the droppable 'hoverclass' option, but add the css class to the draggable instead of the droppable. Is it possible? On Oct 3, 11:26 am, Diodeus <[EMAIL PROTECTED]> wrote: > I'm not sure that answered your question. > > What conditions are required for the hover? > > On Oct 3, 11:10 am, Diodeus <[EMAIL PROTECTED]> wrote: > > > onDrag runs continuously as you drag the item. Use onStart and onEnd. > > > Like this: > > > new Draggable('sample',{onStart:function(){$ > > ('sample').addClassName('dark')},onEnd:function(){$ > > ('sample').removeClassName('dark')}}) > > > On Oct 3, 10:16 am, lfortin <[EMAIL PROTECTED]> wrote: > > > > With the Droppable class, there is an option 'hoverclass', which > > > allows us to temporarily add a css class when an acceptable draggable > > > is hovering it. > > > > I was wondering if such an option exists for the Draggable class? To > > > add a css class to the draggable instead of the droppable in this > > > case? > > > > If it does not exists, do you have a suggestion on how to do it using > > > the onDrag callback? > > > > Thanks in advance, > > > > -Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: 'hoverclass' option for draggables?
I'm not sure that answered your question. What conditions are required for the hover? On Oct 3, 11:10 am, Diodeus <[EMAIL PROTECTED]> wrote: > onDrag runs continuously as you drag the item. Use onStart and onEnd. > > Like this: > > new Draggable('sample',{onStart:function(){$ > ('sample').addClassName('dark')},onEnd:function(){$ > ('sample').removeClassName('dark')}}) > > On Oct 3, 10:16 am, lfortin <[EMAIL PROTECTED]> wrote: > > > With the Droppable class, there is an option 'hoverclass', which > > allows us to temporarily add a css class when an acceptable draggable > > is hovering it. > > > I was wondering if such an option exists for the Draggable class? To > > add a css class to the draggable instead of the droppable in this > > case? > > > If it does not exists, do you have a suggestion on how to do it using > > the onDrag callback? > > > Thanks in advance, > > > -Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: 'hoverclass' option for draggables?
onDrag runs continuously as you drag the item. Use onStart and onEnd. Like this: new Draggable('sample',{onStart:function(){$ ('sample').addClassName('dark')},onEnd:function(){$ ('sample').removeClassName('dark')}}) On Oct 3, 10:16 am, lfortin <[EMAIL PROTECTED]> wrote: > With the Droppable class, there is an option 'hoverclass', which > allows us to temporarily add a css class when an acceptable draggable > is hovering it. > > I was wondering if such an option exists for the Draggable class? To > add a css class to the draggable instead of the droppable in this > case? > > If it does not exists, do you have a suggestion on how to do it using > the onDrag callback? > > Thanks in advance, > > -Laurent --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---