Skip to content

Instantly share code, notes, and snippets.

@4noha
Last active June 9, 2017 04:30
Show Gist options
  • Save 4noha/6bb4dbfe7d2a0c4ea2839f5fa53f0741 to your computer and use it in GitHub Desktop.
Save 4noha/6bb4dbfe7d2a0c4ea2839f5fa53f0741 to your computer and use it in GitHub Desktop.
コンフルのHTMLブロックプラギンに入れるとヘッダがスクロールイベントにに反応してパリピ仕様になる
<script type="text/javascript">
$(function(){
$(window).scroll(function () {
// 16777216 = 0xFFFFFF + 1
var rgb = Math.floor( Math.random() * 16777216 ).toString( 16 );
zerofill = 6 - rgb.length;
for ( ; zerofill > 0; zerofill-- ) {
rgb = '0' + rgb;
}
$( '#header' ).children( 'nav' ).css({ 'background-color': '#' + rgb });
// 変色スピード1/2
angle = Math.floor( window.pageYOffset / 2 ) % 360;
$('#quick-create-page-button').css({ 'background-color': 'hsl(' + angle + ',100%,60%)' });
$( '#create-page-button' ).css({ 'background-color': 'hsl(' + angle + ',100%,60%)' });
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment