Difference between revisions of "Team:IIT Delhi/home"

Line 201: Line 201:
 
     });
 
     });
 
   </script>           
 
   </script>           
<script>
+
     
$(document).ready(function(){
+
console.log("hi2");
+
/**
+
* 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').each(function(){
+
var $this = $(this);
+
var $span = $this.children('span');
+
$span.data('width',$span.width());
+
+
$this.bind('mouseenter',function(){
+
$menu.find('.ldd_submenu').stop(true,true).hide();
+
$span.stop().animate({'width':'10%'},200,function(){
+
$this.find('.ldd_submenu').slideDown(400);
+
});
+
}).bind('mouseleave',function(){
+
/**$this.find('.ldd_submenu').stop(true,true).hide(); */
+
$span.stop().animate({'width':$span.data('width')+'px'},300);
+
$this.find('.ldd_submenu').slideUp(400);
+
});
+
});
+
            });
+
+
//ipad and iphone fix
+
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
+
    $(" #ldd_menu li a").click(function(){
+
        //we just need to attach a click event listener to provoke iPhone/iPod/iPad's hover event
+
        //strange
+
    });
+
}
+
</script>
+
   
+
 
</body>
 
</body>
 
</html>
 
</html>

Revision as of 00:13, 17 September 2015