/[drupal]/contributions/modules/nice_menus/nice_menus.js
ViewVC logotype

Diff of /contributions/modules/nice_menus/nice_menus.js

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.16, Mon Aug 4 23:45:22 2008 UTC revision 1.17, Tue Mar 24 16:22:28 2009 UTC
# Line 1  Line 1 
1  // $Id: nice_menus.js,v 1.15 2008/07/11 16:09:12 add1sun Exp $  // $Id: nice_menus.js,v 1.16 2008/08/04 23:45:22 add1sun Exp $
2    
3  // We need to do some browser sniffing to weed out IE 6 only  // This uses Superfish 1.4.8
4  // because only IE6 needs this hover hack.  // (http://users.tpg.com.au/j_birch/plugins/superfish)
 if (document.all && !window.opera && (navigator.appVersion.search("MSIE 6.0") != -1) && $.browser.msie) {  
   function IEHoverPseudo() {  
       $("ul.nice-menu li.menuparent").hover(function(){  
           $(this).addClass("over").find("> ul").show().addShim();  
         },function(){  
           $(this).removeClass("over").find("> ul").removeShim().hide();  
         }  
       );  
       // Add a hover class to all li for CSS styling. Silly naming is done  
       // so we don't break CSS compatibility for .over class already in use  
       // and due to the fact that IE6 doesn't understand multiple selectors.  
       $("ul.nice-menu li").hover(function(){  
           $(this).addClass("ie-over");  
         },function(){  
           $(this).removeClass("ie-over");  
         }  
       );  
     }  
5    
6      // This is the jquery method of adding a function  // Add Superfish to all Nice menus with some basic options.
7      // to the BODY onload event.  (See jquery.com)  $(document).ready(function() {
8      $(document).ready(function(){ IEHoverPseudo() });    $('ul.nice-menu').superfish({
9  }      // Add the legacy hover class added for IE.
10        hoverClass: 'ie-over',
11  $.fn.addShim = function() {      // Disable generation of arrow mark-up.
12    return this.each(function(){      autoArrows: false,
13            if(document.all && $("select").size() > 0) {      // Disable drop shadows.
14              var ifShim = document.createElement('iframe');      dropShadows: false,
15              ifShim.src = "javascript:false";      // Mouse delay.
16                          ifShim.style.width=$(this).width()+1+"px";      delay: Drupal.settings.nice_menus_options.delay,
17        ifShim.style.height=$(this).find("> li").size()*23+20+"px";      // Animation speed.
18                          ifShim.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";      speed: Drupal.settings.nice_menus_options.speed
19                    ifShim.style.zIndex="0";    });
20      $(this).prepend(ifShim);    // Add in Brandon Aaron’s bgIframe plugin for IE select issues.
21        $(this).css("zIndex","99");    // http://plugins.jquery.com/node/46/release
22                  }    $('ul.nice-menu').superfish().find('ul').bgIframe({opacity:false});
23          });  });
 };  
   
 $.fn.removeShim = function() {  
   return this.each(function(){  
           if (document.all) $("iframe", this).remove();  
         });  
 };  

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.2