Current_page_item met jquery
-
Even in het engels van de normale wordpress.org forums:
This problem is really driving me insane,.
I’m not sure anymore if this is even possible.
Here’s the problem:I have this Fancy Jquery for my navigation on this website i’m building:
http://dragendekracht.nl/test/What i’m trying to accomplish is when clicked on (for example) “mediation” a submenu appears, when clicked on an item in the submenu i want the little gray arrow to remain on it’s parent page (the current position).
It might be extremly easy for some of you,. but for me this is really something i don’t know how to solve. I’ve been searching google for days.
here’s the jquery script:
$(function(){ var $el, leftPos, newWidth, $mainNav = $("#navbar_tabmenu"); $mainNav.append("<li id='magic-line'></li>"); var $magicLine = $("#magic-line"); $magicLine .width($(".current_page_item").width()) .css("left", $(".current_page_item a").position().left) .data("origLeft", $magicLine.position().left) .data("origWidth", $magicLine.width()); $("#navbar_tabmenu li").find("a").hover(function() { $el = $(this); leftPos = $el.position().left; newWidth = $el.parent().width(); $magicLine.stop().animate({ left: leftPos, width: newWidth }); }, function() { $magicLine.stop().animate({ left: $magicLine.data("origLeft"), width: $magicLine.data("origWidth") }); }); });
So how do i use the PHP (or something else for that matter) to make clear to the Jquery script to stop moving the arrow (arrow = magicLine see script) if clicked on a subpage?
For anyone who can solve this,.. i’m eternaly gratefull!
- Het onderwerp ‘Current_page_item met jquery’ is gesloten voor nieuwe reacties.