devinsays / portfolio-press

A WordPress theme for artists and designers to showcase their work.
https://wptheming.com/portfolio-theme/
GNU General Public License v2.0
62 stars 30 forks source link

Store the value of `$(this).find("ul")` in a variable #61

Closed mfields closed 10 years ago

mfields commented 10 years ago

In portfolio_desktop_submenus() it's probably better to store the result of $(this).find("ul") in a variable that can be reused instead of re querying multiple times. Especially because this function is called on window resize.

devinsays commented 10 years ago

Updated this to cache those selectors.

The code doesn't get run every time though. It only runs if PortfolioPressJS.submenu isn't set. After it runs, PortfolioPressJS.submenu is set to true. It won't run again unless the size of the browser drops below 780px and is then expanded again to a larger size.