mobile-uls.js 572 B

123456789101112131415161718192021222324
  1. /* eslint-disable no-jquery/no-global-selector */
  2. $( function () {
  3. var mobileMediaQuery = window.matchMedia( 'screen and (max-width: 550px)' ),
  4. ULSTrigger = $( '#pt-uls' ),
  5. ULSMoved = false;
  6. function moveULS() {
  7. if ( ULSTrigger.length ) {
  8. if ( !ULSMoved && mobileMediaQuery.matches ) {
  9. ULSTrigger.insertBefore( $( '#pt-preferences' ) );
  10. ULSMoved = true;
  11. } else if ( ULSMoved && !mobileMediaQuery.matches ) {
  12. ULSTrigger.prepend( $( '#p-preferences' ) );
  13. ULSMoved = false;
  14. }
  15. }
  16. }
  17. $( window ).on( 'resize', moveULS );
  18. moveULS();
  19. } );