Created
January 29, 2020 17:06
-
-
Save RyanNutt/0967c495a04fb8d47483d456ffef4826 to your computer and use it in GitHub Desktop.
jQuery plugin to move elements to top or bottom of parent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Move an element to the top of the stack by appending it to the end | |
* of its parent. | |
* | |
* The element, and its siblings, should be positioned in parent so that | |
* they're stacked on top of each other. | |
*/ | |
(function ($) { | |
$.fn.moveToBottom = function () { | |
return this.parent().prepend(this); | |
}; | |
$.fn.moveToTop = function () { | |
return this.parent().append(this); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment