Re: [jQuery] New Plugin: mousewheel
I think, there is a little bug in your plugin. If you use $(this) in the event function, your are pointing (in firefox) to the window instead to the element. Here is my code (firebug is your fried :): $('.leaf').mousewheel(function(event, delta){ if (delta 0) { console.info(Up); console.log($(this)); //will return [window] } else if (delta 0) { console.info(Down); } },true); Mathias 2006/9/29, Brandon Aaron [EMAIL PROTECTED]: I overrode the mousewheel method... I don't think I used the correct terminology there. That should be 'I overloaded' instead of 'I overrode' ... at least I think so. -- Brandon Aaron On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: Okay ... I've updated the plugin once again. I overrode the mousewheel method to take an optional two functions instead of one. The first function is the up handler and the second function is the down handler. The preventDefault is still the last param. I also added mousewheelup and mousewheeldown along with unmousewheelup and unmousewheeldown. However, you can't chain mousewheelup and mousewheeldown together. The last one in the chain will override the previous. Also unmousewheelup and unmousewheeldown will remove both up and down if they exist. I tried to get around this but couldn't easily do so. If you need a seperate function for both up and down, just use mousewheel method with two functions. The example/test page is updated as well as the SVN. The blog entry however, is not updated yet. I've also posted this on the plugins page of jquery.com. Brandon ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Thanks Mathias! I've gone ahead and fixed it in SVN but haven't updated the example/test yet. http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js -- Brandon Aaron On 10/5/06, Mathias Bank [EMAIL PROTECTED] wrote: I think, there is a little bug in your plugin. If you use $(this) in the event function, your are pointing (in firefox) to the window instead to the element. Here is my code (firebug is your fried :): $('.leaf').mousewheel(function(event, delta){ if (delta 0) { console.info(Up); console.log($(this)); //will return [window] } else if (delta 0) { console.info(Down); } },true); Mathias 2006/9/29, Brandon Aaron [EMAIL PROTECTED]: I overrode the mousewheel method... I don't think I used the correct terminology there. That should be 'I overloaded' instead of 'I overrode' ... at least I think so. -- Brandon Aaron On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: Okay ... I've updated the plugin once again. I overrode the mousewheel method to take an optional two functions instead of one. The first function is the up handler and the second function is the down handler. The preventDefault is still the last param. I also added mousewheelup and mousewheeldown along with unmousewheelup and unmousewheeldown. However, you can't chain mousewheelup and mousewheeldown together. The last one in the chain will override the previous. Also unmousewheelup and unmousewheeldown will remove both up and down if they exist. I tried to get around this but couldn't easily do so. If you need a seperate function for both up and down, just use mousewheel method with two functions. The example/test page is updated as well as the SVN. The blog entry however, is not updated yet. I've also posted this on the plugins page of jquery.com. Brandon ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
- The addition of mousewheelup/mousewheeldown methods. Are these really necessary? I think adding these might increase the code considerably without much more benefit. The mousewheelup/down is represented by the event.detail and/or event.wheelDelta. Although the event.detail and event.wheelDelta have a different idea of which way is up and which way is down. I'll have to see how much code it adds by adding these two methods. - The standardization of an event.detail and/or event.wheelDelta (IMO, I think wheelDelta makes more sense). This way you can access the same property in all browsers. I decided to use event.detail as the magitude is represented by 'smaller' numbers instead of in multiples of 120. In IE I take the value of wheelDelta and divide it by 120 and I suppose I could do the opposite for Firefox and add the wheelDelta property. I think that is a good idea. Do you still need testing for Opera and Safari? I realize that you said that Safari didn't work, but I'm sure that there's a couple of us here who can research into this some more, to find a good cross-browser solution. Safari in its current released version is hopeless. I believe I should probably do some testing on Opera as it probably supports IE's onmousewheel. Brandon On 9/27/06, John Resig [EMAIL PROTECTED] wrote: Great plugin. Couple recommendation: - The addition of mousewheelup/mousewheeldown methods. - The standardization of an event.detail and/or event.wheelDelta (IMO, I think wheelDelta makes more sense). This way you can access the same property in all browsers. Do you still need testing for Opera and Safari? I realize that you said that Safari didn't work, but I'm sure that there's a couple of us here who can research into this some more, to find a good cross-browser solution. Keep up the great work! --John On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: I've finished my mousewheel plugin + docs + test/example. The example/test page: http://brandonaaron.net/jquery/mousewheel/mousewheel.html The code: http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js The blog entry: http://brandonaaron.net/articles/2006/09/28/jquery-plugin-mousewheel The blog entry is just me rambling a little bit. The inline docs are probably better. The biggest annoyance/issue was that Firefox/Mozilla doesn't allow the DOMMouseScroll event to be cancelable. So I had to hack around it but finally figured out a way to allow the default to be prevented. BTW, this uses the $().hover method and it has a bug that I've logged and supplied a patch for here: http://jquery.com/dev/bugs/bug/222/ As this is my first plugin, if there is anything I should do differently or any enhancements I could make (or if you find any bugs) just let me know. :) Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
- The addition of mousewheelup/mousewheeldown methods. Are these really necessary? I think adding these might increase the code considerably without much more benefit. The mousewheelup/down is represented by the event.detail and/or event.wheelDelta. Although the event.detail and event.wheelDelta have a different idea of which way is up and which way is down. I'll have to see how much code it adds by adding these two methods. Actually, I suppose it could be more like the hover event method and take two functions. One would be for the mousewheeldown and the other for the mousewheelup. Then no one would have to worry about the event.detail and/or event.wheelDelta (unless they wanted to know the magnitude). Also, if only one function is passed I could write it to act like it currently does. Does that sound useful? Brandon On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: - The addition of mousewheelup/mousewheeldown methods. Are these really necessary? I think adding these might increase the code considerably without much more benefit. The mousewheelup/down is represented by the event.detail and/or event.wheelDelta. Although the event.detail and event.wheelDelta have a different idea of which way is up and which way is down. I'll have to see how much code it adds by adding these two methods. - The standardization of an event.detail and/or event.wheelDelta (IMO, I think wheelDelta makes more sense). This way you can access the same property in all browsers. I decided to use event.detail as the magitude is represented by 'smaller' numbers instead of in multiples of 120. In IE I take the value of wheelDelta and divide it by 120 and I suppose I could do the opposite for Firefox and add the wheelDelta property. I think that is a good idea. Do you still need testing for Opera and Safari? I realize that you said that Safari didn't work, but I'm sure that there's a couple of us here who can research into this some more, to find a good cross-browser solution. Safari in its current released version is hopeless. I believe I should probably do some testing on Opera as it probably supports IE's onmousewheel. Brandon On 9/27/06, John Resig [EMAIL PROTECTED] wrote: Great plugin. Couple recommendation: - The addition of mousewheelup/mousewheeldown methods. - The standardization of an event.detail and/or event.wheelDelta (IMO, I think wheelDelta makes more sense). This way you can access the same property in all browsers. Do you still need testing for Opera and Safari? I realize that you said that Safari didn't work, but I'm sure that there's a couple of us here who can research into this some more, to find a good cross-browser solution. Keep up the great work! --John On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: I've finished my mousewheel plugin + docs + test/example. The example/test page: http://brandonaaron.net/jquery/mousewheel/mousewheel.html The code: http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js The blog entry: http://brandonaaron.net/articles/2006/09/28/jquery-plugin-mousewheel The blog entry is just me rambling a little bit. The inline docs are probably better. The biggest annoyance/issue was that Firefox/Mozilla doesn't allow the DOMMouseScroll event to be cancelable. So I had to hack around it but finally figured out a way to allow the default to be prevented. BTW, this uses the $().hover method and it has a bug that I've logged and supplied a patch for here: http://jquery.com/dev/bugs/bug/222/ As this is my first plugin, if there is anything I should do differently or any enhancements I could make (or if you find any bugs) just let me know. :) Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Seems to work fine for me in IE6/PC. But I'm not sure what the difference between one and two is. !//-- andy matthews web developer certified advanced coldfusion programmer ICGLink, Inc. [EMAIL PROTECTED] 615.370.1530 x737 --//- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Brandon Aaron Sent: Wednesday, September 27, 2006 11:04 PM To: jQuery Discussion. Subject: [jQuery] New Plugin: mousewheel I've finished my mousewheel plugin + docs + test/example. The example/test page: http://brandonaaron.net/jquery/mousewheel/mousewheel.html The code: http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js The blog entry: http://brandonaaron.net/articles/2006/09/28/jquery-plugin-mousewheel The blog entry is just me rambling a little bit. The inline docs are probably better. The biggest annoyance/issue was that Firefox/Mozilla doesn't allow the DOMMouseScroll event to be cancelable. So I had to hack around it but finally figured out a way to allow the default to be prevented. BTW, this uses the $().hover method and it has a bug that I've logged and supplied a patch for here: http://jquery.com/dev/bugs/bug/222/ As this is my first plugin, if there is anything I should do differently or any enhancements I could make (or if you find any bugs) just let me know. :) Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/ ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Safari in its current released version is hopeless. I take that back. I'll do some testing and see what I can figure out to make this work in Safari. Also, sorry for not putting the [jQuery] tag on this thread and continuing to reply to my own thread. :) Brandon ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Quote Andy Seems to work fine for me in IE6/PC. But I'm not sure what the difference between one and two is.Test1...the box will scroll out of view (off the top of the page)whereas Test2 will remain staticthe page does not scroll ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
I see... I didn't use the mousewheel enough to make it go off the bottom. Just a note, now it's not working in IE at all. !//--andy matthewsweb developercertified advanced coldfusion programmerICGLink, Inc.[EMAIL PROTECTED]615.370.1530 x737--//- -Original Message-From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Giuliano MarcangeloSent: Thursday, September 28, 2006 8:52 AMTo: jQuery Discussion.Subject: Re: [jQuery] New Plugin: mousewheel Quote Andy "Seems to work fine for me in IE6/PC. But I'm not sure what the differencebetween one and two is."Test1...the box will scroll out of view (off the top of the page)whereas Test2 will remain staticthe page does not scroll ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Now that is works in the major browsers I'll think about adding the mousewheelup and mousewheeldown but I'm still thinking it will just add unecessary complication to the code. I don't think it'll complicate it at all - it's like saying that .mouseup() and .mousedown() are complicated and should just use .mouse() instead. I also think that suggestion that you made of having a .mousewheel() method that takes two functions would work really well too. Having all three methods would add virtually no overhead to your code, while making it much more robust. (Maybe a 100 bytes?) --John ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Okay ... I've updated the plugin once again. I overrode the mousewheel method to take an optional two functions instead of one. The first function is the up handler and the second function is the down handler. The preventDefault is still the last param. I also added mousewheelup and mousewheeldown along with unmousewheelup and unmousewheeldown. However, you can't chain mousewheelup and mousewheeldown together. The last one in the chain will override the previous. Also unmousewheelup and unmousewheeldown will remove both up and down if they exist. I tried to get around this but couldn't easily do so. If you need a seperate function for both up and down, just use mousewheel method with two functions. The example/test page is updated as well as the SVN. The blog entry however, is not updated yet. I've also posted this on the plugins page of jquery.com. Brandon ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
I overrode the mousewheel method... I don't think I used the correct terminology there. That should be 'I overloaded' instead of 'I overrode' ... at least I think so. -- Brandon Aaron On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: Okay ... I've updated the plugin once again. I overrode the mousewheel method to take an optional two functions instead of one. The first function is the up handler and the second function is the down handler. The preventDefault is still the last param. I also added mousewheelup and mousewheeldown along with unmousewheelup and unmousewheeldown. However, you can't chain mousewheelup and mousewheeldown together. The last one in the chain will override the previous. Also unmousewheelup and unmousewheeldown will remove both up and down if they exist. I tried to get around this but couldn't easily do so. If you need a seperate function for both up and down, just use mousewheel method with two functions. The example/test page is updated as well as the SVN. The blog entry however, is not updated yet. I've also posted this on the plugins page of jquery.com. Brandon ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
[jQuery] New Plugin: mousewheel
I've finished my mousewheel plugin + docs + test/example. The example/test page: http://brandonaaron.net/jquery/mousewheel/mousewheel.html The code: http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js The blog entry: http://brandonaaron.net/articles/2006/09/28/jquery-plugin-mousewheel The blog entry is just me rambling a little bit. The inline docs are probably better. The biggest annoyance/issue was that Firefox/Mozilla doesn't allow the DOMMouseScroll event to be cancelable. So I had to hack around it but finally figured out a way to allow the default to be prevented. BTW, this uses the $().hover method and it has a bug that I've logged and supplied a patch for here: http://jquery.com/dev/bugs/bug/222/ As this is my first plugin, if there is anything I should do differently or any enhancements I could make (or if you find any bugs) just let me know. :) Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/
Re: [jQuery] New Plugin: mousewheel
Great plugin. Couple recommendation: - The addition of mousewheelup/mousewheeldown methods. - The standardization of an event.detail and/or event.wheelDelta (IMO, I think wheelDelta makes more sense). This way you can access the same property in all browsers. Do you still need testing for Opera and Safari? I realize that you said that Safari didn't work, but I'm sure that there's a couple of us here who can research into this some more, to find a good cross-browser solution. Keep up the great work! --John On 9/28/06, Brandon Aaron [EMAIL PROTECTED] wrote: I've finished my mousewheel plugin + docs + test/example. The example/test page: http://brandonaaron.net/jquery/mousewheel/mousewheel.html The code: http://svn.brandonaaron.net/svn/jquery_plugins/mousewheel.js The blog entry: http://brandonaaron.net/articles/2006/09/28/jquery-plugin-mousewheel The blog entry is just me rambling a little bit. The inline docs are probably better. The biggest annoyance/issue was that Firefox/Mozilla doesn't allow the DOMMouseScroll event to be cancelable. So I had to hack around it but finally figured out a way to allow the default to be prevented. BTW, this uses the $().hover method and it has a bug that I've logged and supplied a patch for here: http://jquery.com/dev/bugs/bug/222/ As this is my first plugin, if there is anything I should do differently or any enhancements I could make (or if you find any bugs) just let me know. :) Brandon Aaron ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/