Posted By

rumremix on 06/15/12


Tagged

hover global nav child Parent sharepoint


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jlaws0n


get hover effect of global nav parent link to roll off at same time dropdown goes away in out of the box sharepoint global nav


 / Published in: JavaScript
 

The class, "activeDDParent", needs css that will cause the parent to have the same hover effect it has when the mouse hovers over it. This class allows for the out-of-the-box sharepoint rollof delay. "portalnavwrapper" is just the class of a div I have that surrounds the global navigation piece. But this can be anything that encompasses the entire navigation region.

  1. <script type="text/javascript">
  2. var thishchild;
  3. $(function() {
  4.  
  5. $('div[id*=zz1_GlobalNavigationn]').hover(
  6. function () {
  7. parentHighlight($(this));
  8. },
  9. function () {
  10. }
  11. );
  12.  
  13. $('.portalnavwrapper').hover(
  14. function () {
  15. },
  16. function () {
  17. setTimeout("rollOffAll()",500);
  18. }
  19. );
  20.  
  21.  
  22. });
  23.  
  24.  
  25. function parentHighlight(child) {
  26. var linkIndex = child.attr('id');
  27. if (linkIndex.indexOf("Items") > -1 ) {
  28. linkIndex = linkIndex.split("GlobalNavigationn")[1];
  29. linkIndex = linkIndex.split('Items')[0];
  30. $('#zz1_GlobalNavigationn' + linkIndex).addClass('activeDDParent');
  31. }
  32. }
  33.  
  34. function rollOffAll() {
  35. $(".activeDDParent").removeClass("activeDDParent");
  36.  
  37. }
  38.  
  39.  
  40. </script>

Report this snippet  

You need to login to post a comment.