dutchcelt/Keep-in-View

Incorrectly written jQuery plugin

Closed this issue · 3 comments

jQuery plugins should follow certain guidelines, and yours doesn't:

  1. This plugin breaks call chaining. You should return this from your plugin and execute calls on whatever elements are provided by the jQuery set.
  2. This plugin assumes there's only one element in the jQuery set and operates on that. It should rather execute each statement internally to operate on all elements provided.

I'll take a look at that. I must be used to plugins doing this as I tend to avoid chaining. There are a number of fixes coming including updating the width on window resizing.

Thanks for the heads up. I've pushed the fix for the chaining issue.

Your last update seems to address both issues I've pointed out. That's fine then.
But...
Don't forget to update your example/demo, because you're doing each manually in your demo, which is of course not necessary any more because you're doing it in your plugin.