Skip to content

Instantly share code, notes, and snippets.

@scott-riley
Last active August 29, 2015 14:03
Show Gist options
  • Save scott-riley/6099bc852814d8ca4daf to your computer and use it in GitHub Desktop.
Save scott-riley/6099bc852814d8ca4daf to your computer and use it in GitHub Desktop.
$list = $('.collections__list');
$item = $list.find('.list__item--is-selected');
$prev = $item.prev();
$prepended = false;
if ($(window).width() < 700 && $item.index() != 0 && !prepended) {
$list.prependTo('.collections__list');
prepended = true;
}
else if ($(window).width() > 700 && prepended) {
$list.prependTo('.collections__list');
$prev.after($item);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment