[JavaScript] jQuery CSS3 登录下拉菜单 →→→→→进入此内容的聊天室

来自 , 2019-12-26, 写在 JavaScript, 查看 199 次.
URL http://www.code666.cn/view/32bb90e8
  1. /*
  2.  
  3. jQuery FormBox - Copyright AddyOsmani.com, 2010.
  4. Released under the GPL for open-source use
  5.  
  6.  */
  7.  
  8. $(window).load(function ()
  9. {
  10.    
  11.     var tabs = $("#tabs");
  12.     var tabPanesContainer = $("ul#tabPanes");
  13.     var tabPanesAll = tabPanesContainer.find("li").css("position", "absolute");
  14.     var tabMenuLinks = $("ul#tabMenu .dropdown");
  15.     var regularLinks = $("ul#tabMenu .regular");
  16.     var dropDownSpeed = 200;
  17.     var dropUpSpeed = 200;
  18.     var menuHeight = '240px';
  19.    
  20.     /*Close the currently open menu*/
  21.     function closeMenu()
  22.     {
  23.        
  24.         tabMenuLinks.removeClass('activeTab');
  25.        
  26.         tabPanesContainer.stop().animate(
  27.         {
  28.             height : '0px'
  29.         }, dropUpSpeed);
  30.        
  31.     }
  32.    
  33.     /*Handle non tab-menu links*/
  34.     regularLinks.hover(function ()
  35.     {
  36.         tabPanesContainer.stop().animate(
  37.         {
  38.             height : '0px'
  39.         }
  40.         );
  41.        
  42.         tabMenuLinks.removeClass('activeTab');
  43.         $(this).addClass('activeTab');
  44.        
  45.     }, function ()
  46.     {
  47.         $(this).removeClass('activeTab');
  48.        
  49.     }
  50.     );
  51.    
  52.     /*Handle tab-menu links*/
  53.     tabMenuLinks.hover(function ()
  54.     {
  55.        
  56.         var thisMenuItem = $(this);
  57.        
  58.         /*get the offset of this item in respect to the page*/
  59.         var thisMargin = thisMenuItem.offset().left;
  60.        
  61.         /*get the offset of the navigation bar in respect to the page*/
  62.         var tabsOffset = tabs.offset().left;
  63.         var thisIndex = thisMenuItem.index();
  64.        
  65.         thisMargin = Math.floor(thisMargin - tabsOffset);
  66.        
  67.         var thisOffset = thisMargin - 52;
  68.        
  69.         /* handle IE margin difference*/
  70.         if ($.browser.msie)
  71.         {
  72.             thisOffset = thisMargin - 15;
  73.         }
  74.        
  75.         tabPanesContainer.css('margin-left', thisOffset);
  76.        
  77.         tabPanesContainer.stop().animate(
  78.         {
  79.             height : menuHeight
  80.         }, dropDownSpeed);
  81.        
  82.         tabMenuLinks.removeClass('activeTab');
  83.         thisMenuItem.addClass('activeTab');
  84.        
  85.         var thisHash = thisMenuItem.find("a").attr('href');
  86.         var tabClicked = tabPanesAll.filter(thisHash);
  87.        
  88.         tabClicked.appendTo(tabPanesContainer).show();
  89.        
  90.         return false;
  91.        
  92.     }, function ()
  93.     {
  94.        
  95.         $(this).stop();
  96.        
  97.     }
  98.     );
  99.    
  100.     /*
  101.     Display Tooltips on hovering over the input fields if an
  102.     alt tag is present
  103.      */
  104.     $('input').hover(function ()
  105.     {
  106.         var thisItem = $(this);
  107.         var msgTip = thisItem.attr('alt');
  108.        
  109.         if (msgTip.length)
  110.         {
  111.            
  112.             $('body').append('<div id="menuTooltip">\
  113.                                         <p>' + msgTip + '</p>\</div>');
  114.            
  115.             var pos = thisItem.offset();
  116.             var width = thisItem.width();
  117.            
  118.             $("#menuTooltip").css(
  119.             {
  120.                 "left" : (pos.left + 115) + "px",
  121.                 "top" : pos.top - 90 + "px"
  122.             }
  123.             );
  124.             $("#menuTooltip").fadeIn('slow');
  125.         }
  126.        
  127.     }, function ()
  128.     {
  129.        
  130.         $('div#menuTooltip').remove();
  131.        
  132.     }
  133.     );
  134.    
  135.     /*Handle a user hovering over the tab container*/
  136.     tabPanesContainer.hover(function ()
  137.     {}, function ()
  138.     {
  139.         closeMenu();
  140.     }
  141.     );
  142.    
  143.     $('.edges').hover(function ()
  144.     {
  145.         closeMenu();
  146.        
  147.     }, function ()
  148.     {}
  149.    
  150.     );
  151.    
  152. }
  153. );
  154.  

回复 "jQuery CSS3 登录下拉菜单"

这儿你可以回复上面这条便签

captcha