My JQuery Plugin Review
Anonymous# June 22, 2014 at 2:41 pm
I say i’m about done with my first ever jQuery plugin. All theres left to do is extensive testing and i guess improvements. It’s a very simple Plugin that doesn’t do much because i tried to make really simple as its my first plugin. So i’m looking for ways i could improve it in any way or what problems there are. Its basically a menu for links that lets the users choose where to open the link, when simply right clicking on the link is too much work.
Just hover over the links# June 25, 2014 at 1:32 am
Are you asking about the plugin itself or about the coding style, or both?
If you’re asking about the functionality, you also might want to check the position of your popup. If it’s near an edge it will go partially out-of-view. You don’t see that in your demo since there is a lot of padding.
As for coding style, I would suggest:
Anonymous# June 26, 2014 at 6:44 am
- Chaining functions more. It’s one of the advantages of using jQuery.
- Cache your variables. I see lots of
$(this)in the code.
- Run your code through a linter, like JSHint to learn more about some of the suggested standards (suggestions, not requirements).
- Share a non-compressed version with comments.
- Take some credit for your work. Even adding one line to the compressed version won’t hurt anything. It will tell others who made the plugin and where to look for more information, or find more of your other works. :)
@senff I noticed that, but im actually trying to find a better way to show and hide the menu on hover. What i do now is delay the hide for 300ms when the mouse leaves the link, and wait for the cursor to enter the menu before the 300ms times out. I think thats kind of an unreliable way of doing it. Any suggestions?
@nkrisc The menu is styles using a separate css stylesheet that the user can edit.
@mottie i didn’t notice it was off-center. What do you think the formula is for centering the menu according to the link width? I added the menuwidth and linkwidth and divided by 2. That seemed to work but i guess it doesn’t :P
You must be logged in to reply to this topic.