Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript My JQuery Plugin Review

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #173445
    Anonymous
    Inactive

    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

    #173563
    Senff
    Participant

    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.

    #173630
    Mottie
    Member

    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. :)
    #173745
    Anonymous
    Inactive

    @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

    #173977
    Anonymous
    Inactive

    Are there better ways to hide and show the menu?

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.