Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Aktywna zakładka menu
Forum PHP.pl > Forum > Po stronie przeglądarki
Julcio
Potrzebuję zrobić w tym kodzie tak, aby zakładka, która jest aktualnie wyświetlana, wyróżniała się, miała wygląd taki jak hover.

  1. <?php
  2.  
  3. /**
  4.   * Primary Menu Admin Options
  5.   */
  6.  
  7. $this->admin_option(array('Primary Menu', 21),
  8. 'Primary Menu', 'menu_primary_info',
  9. 'content', 'Please, use the <a href="nav-menus.php"><strong>menus panel</strong></a> to manage and organize menu items for the <strong>primary menu</strong>.<br />The primary menu will display the pages list if no menu is selected from the menus panel. <a href="http://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">More info.</a>'
  10. );
  11.  
  12. $this->admin_option('Primary Menu',
  13. 'Primary Menu Enabled?', 'menu_primary',
  14. 'checkbox', $this->options['menus']['menu-primary']['active'],
  15. array('display'=>'inline')
  16. );
  17.  
  18. $this->admin_option('Primary Menu',
  19. 'Drop Down Settings', 'menu_primary_drop_down',
  20. 'content', ''
  21. );
  22.  
  23. $this->admin_option('Primary Menu',
  24. 'Depth', 'menu_primary_depth',
  25. 'text', $this->options['menus']['menu-primary']['depth'],
  26. array('help'=>'Drop Down levels depth. 0 = unlimited', 'display'=>'inline', 'style'=>'width: 80px;')
  27. );
  28.  
  29. $this->admin_option('Primary Menu',
  30. 'Effect', 'menu_primary_effect',
  31. 'select', $this->options['menus']['menu-primary']['effect'],
  32. array('help'=>'Drop Down animation effect.', 'display'=>'inline', 'options'=>array('standart' => 'Standart (No Effect)', 'slide' => 'Slide Down', 'fade' => 'Fade', 'fade_slide_right' => 'Fade & Slide from Right', 'fade_slide_left' => 'Fade & Slide from Left'))
  33. );
  34.  
  35. $this->admin_option('Primary Menu',
  36. 'Speed', 'menu_primary_speed',
  37. 'text', $this->options['menus']['menu-primary']['speed'],
  38. array('help'=>'Speed of the drop down animation.', 'display'=>'inline', 'style'=>'width: 80px;', 'suffix'=> ' <em>milliseconds</em>')
  39. );
  40.  
  41. $this->admin_option('Primary Menu',
  42. 'Delay', 'menu_primary_delay',
  43. 'text', $this->options['menus']['menu-primary']['delay'],
  44. array('help'=>'The delay in milliseconds that the mouse can remain outside a submenu without it closing ', 'display'=>'inline', 'style'=>'width: 80px;', 'suffix'=> ' <em>milliseconds</em>')
  45. );
  46.  
  47. $this->admin_option('Primary Menu',
  48. 'Arrows', 'menu_primary_arrows',
  49. 'checkbox', $this->options['menus']['menu-primary']['arrows'],
  50. array('help'=>'Display the sub-menu indicator arrows', 'display'=>'inline')
  51. );
  52.  
  53. $this->admin_option('Primary Menu',
  54. 'Drop Shadows', 'menu_primary_shadows',
  55. 'checkbox', $this->options['menus']['menu-primary']['shadows'],
  56. array('help'=>'Display Drop Shadows for the sub-menus', 'display'=>'inline')
  57. );
  58.  
  59.  
  60. /**
  61.   * Display Primary Menu
  62.   */
  63.  
  64. if($this->display('menu_primary')) {
  65.  
  66. // Register
  67. register_nav_menu( 'primary', __( 'Primary Menu', 'themater' ) );
  68.  
  69. // Display Hook
  70. $this->add_hook($this->options['menus']['menu-primary']['hook'], 'themater_menu_primary_display');
  71.  
  72. function themater_menu_primary_scripts() {
  73. wp_enqueue_script( 'hoverIntent', THEMATER_URL . '/js/hoverIntent.js', array('jquery') );
  74. wp_enqueue_script( 'superfish', THEMATER_URL . '/js/superfish.js', array('jquery') );
  75. }
  76. add_action('wp_enqueue_scripts', 'themater_menu_primary_scripts');
  77.  
  78. $this->custom_js(themater_menu_primary_js());
  79. }
  80.  
  81. /**
  82.   * Primary Menu Functions
  83.   */
  84.  
  85. function themater_menu_primary_display()
  86. {
  87. global $theme;
  88. ?>
  89. <?php wp_nav_menu( 'depth=' . $theme->get_option('menu_primary_depth') . '&theme_location=' . $theme->options['menus']['menu-primary']['theme_location'] . '&container_class=' . $theme->options['menus']['menu-primary']['wrap_class'] . '&menu_class=' . $theme->options['menus']['menu-primary']['menu_class'] . '&fallback_cb=' . $theme->options['menus']['menu-primary']['fallback'] . ''); ?>
  90. <!--.primary menu-->
  91. <?php
  92. }
  93.  
  94. function themater_menu_primary_default()
  95. {
  96. global $theme;
  97. ?>
  98. <div class="<?php echo $theme->options['menus']['menu-primary']['wrap_class']; ?>">
  99. <ul class="<?php echo $theme->options['menus']['menu-primary']['menu_class']; ?>">
  100. <li <?php if(is_home() || is_front_page()) { ?>class="current_page_item"<?php } ?>><a href="<?php echo home_url(); ?>"><?php _e('Home','themater'); ?></a></li>
  101. <?php wp_list_pages('depth=' . $theme->get_option('menu_primary_depth') . '&sort_column=menu_order&title_li=' ); ?>
  102. </ul>
  103. </div>
  104. <?php
  105. }
  106.  
  107. function themater_menu_primary_js()
  108. {
  109. global $theme;
  110.  
  111. $return = '';
  112.  
  113. $menu_primary_arrows = $theme->display('menu_primary_arrows') ? 'true' : 'false';
  114. $menu_primary_shadows = $theme->display('menu_primary_shadows') ? 'true' : 'false';
  115. $menu_primary_delay = $theme->display('menu_primary_delay') ? $theme->get_option('menu_primary_delay') : '800';
  116. $menu_primary_speed = $theme->display('menu_primary_speed') ? $theme->get_option('menu_primary_speed') : '200';
  117.  
  118. switch ($theme->get_option('menu_primary_effect')) {
  119. case 'standart' :
  120. $menu_primary_effect = "animation: {width:'show'},\n";
  121. break;
  122.  
  123. case 'slide' :
  124. $menu_primary_effect = "animation: {height:'show'},\n";
  125. break;
  126.  
  127. case 'fade' :
  128. $menu_primary_effect = "animation: {opacity:'show'},\n";
  129. break;
  130.  
  131. case 'fade_slide_right' :
  132. $menu_primary_effect = "onBeforeShow: function(){ this.css('marginLeft','20px'); },\n animation: {'marginLeft':'0px',opacity:'show'},\n";
  133. break;
  134.  
  135. case 'fade_slide_left' :
  136. $menu_primary_effect = "onBeforeShow: function(){ this.css('marginLeft','-20px'); },\n animation: {'marginLeft':'0px',opacity:'show'},\n";
  137. break;
  138.  
  139. default:
  140. $menu_primary_effect = "animation: {opacity:'show'},\n";
  141. }
  142.  
  143. $return .= "jQuery(function(){ \n\tjQuery('ul." . $theme->options['menus']['menu-primary']['superfish_class'] . "').superfish({ \n\t";
  144. $return .= $menu_primary_effect;
  145. $return .= "autoArrows: $menu_primary_arrows,
  146. dropShadows: $menu_primary_shadows,
  147. speed: $menu_primary_speed,
  148. delay: $menu_primary_delay
  149. });
  150. });\n";
  151.  
  152. return $return;
  153. }
  154. ?>
erix
Co to w ogóle jest?
Dominator
To jest kod z wordpressa.

Kolego, musisz w CSS pogrzebać, a nie tutaj.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.