Grow your CSS skills. Land your dream job.

My JQuery Plugin Review

  • # 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.

    http://j-v.me/urltargetmenu.js/

    Just hover over the links

    # June 24, 2014 at 6:32 am

    I would suggest to add some sort of a fallback for touchscreens — on those, the popup menu appears when you tap a link, but it also follows the link right away.

    # June 24, 2014 at 11:41 am

    My suggestion would be providing some hooks for custom styling.

    # June 25, 2014 at 1:32 am

    Hi @elkrocke!

    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:

    • 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. :)
    # June 26, 2014 at 6:44 am

    @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

    # June 28, 2014 at 1:37 pm

    Are there better ways to hide and show the menu?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".