Template:Team:HokkaidoU Japan/LargeDropDown/JS
From 2014.igem.org
(Difference between revisions)
Line 6: | Line 6: | ||
_gaq.push(['_trackPageview']); | _gaq.push(['_trackPageview']); | ||
+ | /* | ||
(function() { | (function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
Line 38: | Line 39: | ||
}); | }); | ||
}); | }); | ||
+ | */ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | (function() { | ||
+ | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
+ | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
+ | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
+ | })(); | ||
+ | $(function() { | ||
+ | /** | ||
+ | * the menu | ||
+ | */ | ||
+ | var $menu = $('#ldd_menu'); | ||
+ | |||
+ | /** | ||
+ | * for each list element, | ||
+ | * we show the submenu when hovering and | ||
+ | * expand the span element (title) to 510px | ||
+ | */ | ||
+ | $menu.children('li').slice(1,3).each(function(){ | ||
+ | var $this = $(this); | ||
+ | var $span = $this.children('span'); | ||
+ | $span.data('width',$span.width()); | ||
+ | |||
+ | $this.bind('mouseenter',function(){ | ||
+ | $this.find('.ldd_submenu').slideDown(300); | ||
+ | }); | ||
+ | }).bind('mouseleave',function(){ | ||
+ | $this.find('.ldd_submenu').stop(true,true).hide(); | ||
+ | }); | ||
+ | }); | ||
+ | }); | ||
+ | |||
+ | |||
</script> | </script> | ||
</html> | </html> |
Revision as of 09:17, 5 October 2014