Skip to content

Instantly share code, notes, and snippets.

@zachinglis
Forked from sturobson/gist:0dd3d4e28801bd9f669b
Last active August 29, 2015 14:03
Show Gist options
  • Save zachinglis/1b25557eef590c5bdf8a to your computer and use it in GitHub Desktop.
Save zachinglis/1b25557eef590c5bdf8a to your computer and use it in GitHub Desktop.
$list = $('.collections__list');
$item = $list.find('.list__item--is-selected');
$prev = $item.prev();
if ($(window).width() < 700) {
// collections put whatever collection is selected at top of list on mobile
$list.prependTo('.collections__list');
}
// collections put whatever collection is selected at top of list on mobile
$(window).resize(function() {
if ($(window).width() < 700) {
// collections put whatever collection is selected at top of list on mobile
$prev.after($item);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment