User:Canadabonk/common.js: Difference between revisions
Content deleted Content added
Canadabonk (talk | contribs) No edit summary |
Canadabonk (talk | contribs) No edit summary |
||
Line 150: | Line 150: | ||
} // end fullwide button |
} // end fullwide button |
||
// banner navigation |
|||
$('#p-cosmos-navigation').clone().prependTo('#cosmos-banner-content'); |
$('#p-cosmos-navigation').clone().prependTo('#cosmos-banner-content'); |
||
$('#cosmos-banner-content #p-cosmos-navigation').attr('id', 'ct-bannernav'); |
|||
const bannerNav = $('#ct-bannernav'); |
|||
bannerNav.css('transform', 'translateY(-100%)'); |
|||
$('#mw-content-container').append('<div class="ct-top"></div>'); |
|||
const backToTop = $('.ct-top'); |
|||
backToTop.attr('title', 'Back to top'); |
|||
backToTop.click(function(){ |
|||
window.scrollTo(0,0); |
|||
}); |
|||
backToTop.css({ |
|||
'opacity': '0', |
|||
'transform': 'translateY(100%)' |
|||
}); |
|||
$(window).scroll(function(){ |
|||
if (window.scrollY > 500) { |
|||
bannerNav.css('transform', 'unset'); |
|||
backToTop.css({ |
|||
'opacity': 'unset', |
|||
'transform': 'unset' |
|||
}); |
|||
} else { |
|||
bannerNav.css('transform', 'translateY(-100%)'); |
|||
backToTop.css({ |
|||
'opacity': '0', |
|||
'transform': 'translateY(100%)' |
|||
}); |
|||
} |
|||
}); |
|||
} //end desktop ------------------------------------------------------------------------------------------------------ |
} //end desktop ------------------------------------------------------------------------------------------------------ |