Comment

Comment by sparkygoblue

Consider caching your element selectors like this:

var $image = $('#my-div img');

This way jQuery doesn't have to traverse the DOM more than once to select the element.

Also, I believe you can do all of your mousedown() event code in one block.

Edit: oops, upon further inspection, I see you are doing this all in the console. Caching the selector is still possible, but now I understand why you did the mousedown() event the way you did.

parent sparkygoblue 13 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton