Mi.nishimo (Talk | contribs) |
|||
Line 31: | Line 31: | ||
<body> | <body> | ||
− | <a id="floating" href="#logo" title="top"><img src="https://static.igem.org/mediawiki/2016/9/99/T--Tokyo_Tech--Floating_Button.png" /></a> | + | <a id="floating" href="#logo" title="top" class="scroll_link" ><img src="https://static.igem.org/mediawiki/2016/9/99/T--Tokyo_Tech--Floating_Button.png" /></a> |
+ | |||
+ | <script> | ||
+ | /**** Scroll Link ****/ | ||
+ | |||
+ | $(function(){ | ||
+ | $('.scroll_link').on('click', function(event){ | ||
+ | event.preventDefault(); | ||
+ | |||
+ | var $this = $(this); | ||
+ | var linkTo = $this.attr('href'); | ||
+ | var $target = $(linkTo); | ||
+ | var pos = $target.offset().top; | ||
+ | $('html,body').animate({scrollTop: pos}, 400); | ||
+ | }); | ||
+ | }); | ||
+ | </script> | ||
</body> | </body> | ||
</html> | </html> |
Revision as of 16:10, 18 October 2016