JQuery :: Get An Active Menu - When Page Reload Loose The Class ?

Oct 9, 2011

I would like to get an active menu but when my page reload i loose the class.

With a button it works fine but not when the page reload with a href it only works when i add a #.

View 3 Replies


ADVERTISEMENT

Jquery: Class / Fade - Menu Link "active" Class Not Working

Dec 5, 2009

I have a script that fades links on load and im trying to get this to work on everything but the menu link that has the "active" class

Code:
<div id="menu">
<ul><li id="Home"><a title="Home" href="/" style="opacity: 0.6;">Home</a></li>
<li class="active" id="projects"><a title="projects" href="/projects/" style="opacity: 0.6;">projects</a></li>
<li class="last" id="Contact"><a title="Contact" href="/contact" style="opacity: 0.6;">Contact</a></li>
</ul>
</div>
[Code]...

View 4 Replies View Related

JQuery :: Auto-adding .active Class To Menu?

Apr 11, 2010

I'm trying to add .active class to a menu, based on the URI. It works with URL's like: /, /products, /about, /contact but not anymore when you go to /products/some-product.I know what's wrong, but I can't find a working solution. I've tried a regex, but that didn't work either...

The code:

$(function() {
var path = location.pathname;
if (path) {

[code]....

View 4 Replies View Related

JQuery :: Superfish: Leave Sub <ul> Menu Visible When A Tag Class Is Set As Active

Sep 13, 2009

I'm using superfish for a drop down hover menu. It works perfect except I would like the sub menus to remain visible when one of the <a> tag from the menu has class="active". Here is a quick overview of the menu html:

<ul class="primary-links">
<li>
<a href="main">item parent 1</a>
<ul>

[Code]....

If the current page is main -- class='active' is automatically added to the A tag (with Drupal). If you are currently in page2, the class='active' is added to the A tag of the sub-menu. Now, how can I get the sub menu to be always displayed -- regardless of superfish, either when item parent 1 A tag is set as class='active'of the item child A tag is set as class='active'.

View 1 Replies View Related

JQuery :: Adding Active Class For One Page Link?

Mar 9, 2009

I am working on the project that will be only one page and the menu will link to the same page. The problem is that i can't add active class to the menu the same we did in the normal linked pages. For example, in css we can see .about .menu ul li .active a { color:#black} . This means the menu will be in black when the user is in the about page. I can't do like this in one page scroll menu as there is only one menu. Are there any ways to let the menu change (add active class)when i scroll to some specific part of the page?

View 3 Replies View Related

JQuery :: Superfish.js Show Active Page In Menu?

Sep 13, 2010

I have a simple superfish menu on my site and I'm wondering if there is a way to add a quick line that shows the 'current' page the menu is point to?

this is a wordpress site, I noticed an example [URL] i'm getting closer?!

View 1 Replies View Related

Jquery :: Keep Active Page Highlighted In Navigation Menu On Rollover

Oct 25, 2011

I'm building a WordPress site with a nice jQuery effect that fades/unfades images within a navigation menu on rollover. So when the mouse moves off the image, the colored image should fade back to reveal the original non-colored image. This works perfectly as-is, but client wants the active page to keep its colored/ highlighted menu image when mouse has moved off of it. The bolded line of the code is where I tried to set that up...

Code:
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
<script type="text/javascript"><!-- this is from [URL]-->
// make nav images highlight on hover
// when the DOM is ready:
$(document).ready(function () {
// find the navigation elements and hook the hover event
$('#mainmenu li').hover(function() {
// on hovering over, find the element we want to fade *up*
var fade = $('> div', this);

// if the element is currently being animated (to a fadeOut)...
if (fade.is(':animated')) {
// ...take it's current opacity back up to 1
fade.stop().fadeTo(250, 1);
} else {
// fade in quickly
fade.fadeIn(250);
}}, function () {
// on hovering out, fade the element out
if (!is_page(current)){
var fade = $('> div', this);
if (fade.is(':animated')) {
fade.stop().fadeTo(3000, 0);
} else {
// fade away slowly
fade.fadeOut(2000);
}}});});
</script>

<ul id="mainmenu">
<li id="home">
<a href="/home"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/sara_inactive.png" alt="home" width="152" height="309" /></a>
<div>
<a href="/home"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/sara_active.png" alt="home" width="152" height="309" /></a>
</div>
</li>

WordPress should know whether the page is 'current' or not, so why doesn't this work? Currently the nav images remain highlighted when the mouse moves away. If I remove my attempt (the bolded line of code) then nav rollovers work beautifully, but active page still isn't represented with a colored nav menu image.

View 9 Replies View Related

JQuery :: Insert Iframe - Don't Have To Reload The Page When The Menu Item Is Clicked

Apr 11, 2011

I currently have a website with a number of menu items, many of which result in the main site being redisplayed but with an iframe being inserted somewhere within the middle of the page. The iframe is initially loaded as hidden but there is a JavaScript 'onload' routine which calculates the height of the iframe and then makes it visible in order to avoid the iframe showing scrollbars since the content of the iframe is variable.

Roughly, things look like this:

Menu button: reloads main page and passes one or more parameters, e.g. [url]

Then elements of the main page including the menu are displayed. Then, if specified by the relevant 'func' parameter the iframe is shown using code similar to the following:

This works fine but I was wondering whether there is any way of using jQuery such that I don't have to reload the page when the menu item is clicked. In other words, you'd click on the menu item and the relevant iframe would be inserted within the middle of the website, automatically sized.

View 2 Replies View Related

Rollover Image Menu With Current Page Active?

May 27, 2011

I've created a nav bar for this site - [URL].. I'm using javascript to handle the image rollover which is working just fine. However I want to add to this so that the current page will stay with the second or rollover image. How would you suggest I edit or add to my code so it keeps the second image active if it is the active page? In my script file this is what I'm using for an image:

menu1buttonup = new Image();
menu1buttonup.src = "http://web11.3essentials.com/~cp27358/wp-content/themes/origin/images/menu1.jpg" ;
menu1buttondown = new Image() ;
menu1buttondown.src = "http://web11.3essentials.com/~cp27358/wp-content/themes/origin/images/menu1a.jpg" ;

[Code]...

View 1 Replies View Related

Rollover Image Menu With Current Page Active

May 26, 2011

I've created a nav bar for this site - [URL] - I'm using javascript to handle the image rollover which is working just fine. However I want to add to this so that the current page will stay with the second or rollover image. Do I edit or add to my code so it keeps the second image active if it is the active page?

In my script file this is what I'm using for an image:
menu1buttonup = new Image();
menu1buttonup.src = "[URL]" ;
menu1buttondown = new Image() ;
menu1buttondown.src = "[URL]" ;

Followed by....
function buttondown( buttonname ){
if (document.images) {
document[ buttonname ].src = eval( buttonname + "down.src" );
}} function buttonup ( buttonname ){
if (document.images) {
document[ buttonname ].src = eval( buttonname + "up.src" );
}}

And this is what my list items look like:
<a href="<?php echo home_url(); ?>/?page_id=7" onmouseover="buttondown('menu1button')"
onmouseout="buttonup('menu1button')"><img src="<?php bloginfo('template_url'); ?>/images/menu1.jpg" name="menu1button" /></a>

View 1 Replies View Related

Program Menu Items To Stay Active / When On Current Page

Nov 17, 2010

It was originally an imaged based menu, but they wanted it all changed to css/html. I used quickmenu and it used JS to produce the arrows at the top of each menu item.I'm trying to program the menu items to stay active when on the current page. At first, it looks correct, but if you hover back over the menu, it changes back to the inactive state.

View 1 Replies View Related

Reload Page Upon List/menu Choice

Oct 9, 2005

Could anyone help me out with a peice of script that will reload the page once a choice is made from a list/menu, so dependant on the choice ($_POST data) another list menu will also display when the page reloads .. I tried a few javascripts from google, but none reloaed the page.

View 5 Replies View Related

JQuery :: Turn On An 'inactive-state' CSS Class For A Group Of Divs, Then Reset One Div To The 'active-state' Class?

Feb 2, 2011

I am attempting to make a menu that has a background image that changeswhen you rollover or click a menuitem. I've got the hover effect working fine with CSS, but am trying to implement the click event via jquery with the following:

CSS:
div.SustainResourcesMenuTabs
{ background-image: url('/images/departments/commdev/sustainability/menu_tab.jpg');
}[code]....

My process is to reset the entire menu to the inactive state, then switch on the active state for the item that was clicked. Eventually, the item that was clicked will display its corresponding body section as well. I've tried using the CSS pseudo-class "active", but since the entire div is the link, that is unavailable. I've also tried multiple variations of addClass/removeClass, toggleClass, and setAttribute/removeAttributebut nothing hasworked so far.

View 2 Replies View Related

JQuery :: Adding A Div Class To An Active Li?

Nov 8, 2010

adding a class to an active li. I'm working in drupal, and the system adds a .active class to the DOM of whatever li class was last selected.In my .js file I added the following:

$('document').ready(function(){
var tabActive = $('#tabs-tabset ul.primary li.active a');
tabActive.addClass('tabknotch')
});

This works perfectly...for the first tab. when I navigate to the next tab the class does not change. I thought maybe there's a variable in the dom that is causing the class to not move, so I tried narrowing the div that it looks for and tried this:

$('document').ready(function(){
var tabActive = $('li.active a');
tabActive.addClass('tabknotch')
});

This achieved the exact same results...so there's obviously something I'm missing, but don't know what it is. If it's any help, here are two examples of the generated DOM that occurs when clicking on the active li. The first example is the div that has the class added, and the second is a div that does not have anything added. <li class="overview ui-tabs-selected active first tabknotch"><a href="#overview"><span class="tab">Overview</span></a></li> (this is the active tab where the jQuery succesfully adds the "tabknotch" class)<li class="features ui-tabs-selected active"><a href="#features"><span class="tab">Features</span></a></li> (this is the active tab that does not have the class added when clicked. When this li is active knotchtab remains on the other li that no longer has the .active class attributed)

View 2 Replies View Related

JQuery :: Adding .active Class To Nav?

Sep 14, 2011

I have a single page website and I would like to add an .active class to my links when I reach a certain point on the page (this will be done by unique div or section id's). The classes are currently empty, so I would need to be able to remove and replace the .active class accordingly.

Here is my html:

<
nav
id="main-nav">

[code]....

View 2 Replies View Related

JQuery :: Add Active State Class To CSS?

Jan 11, 2012

Having a navigation menu desighned in photoshop, how can I use jquery to add a active state class to my css which can use the same hover style for active menu?

Here is the HTML code:

<ul id="nav">
<li id="list1"><a href="#"><span>Home</span></a></li>
<li id="list2"><a href="#"><span>About Us</span></a></li>
<li id="list3"><a href="#"><span>Projects</span></a></li>

[Code]....

View 3 Replies View Related

JQuery :: Set Color On Active Class?

Sep 1, 2009

So basically I have this menu, the only problem I have is that I would like the colour of the text depending on which the 'LavaLamp' Image is when loading up to be red. For example when loading up this website (my url to the menu) [URL] I would like the text 'Home' to show red, since it is the active tab on page load.

View 1 Replies View Related

JQuery - Active Navigation With Class?

Dec 18, 2010

I am attempting to set it so that upon clicking a link within this Joomla site (from the navigation menu), the link will become bold. I have already implemented CSS for ".active" and set the "LI" class to 'active' to the first class.

I have done a search for the JQuery code to do this, but each example that I tried did not work at all. The class remained to be on the first link, home.

[Code]...

View 1 Replies View Related

JQuery :: Auto-Selecting Navigation - Add A Class To My Menu For The Page

Sep 12, 2009

I am trying to add a class to my menu for the page it is currently on.

I followed this example: [url]

But I am not able to make it work at all.

Here is my HTML:

To make the nav element highlighted, the list item must have a class of 'hover' like this '<li class="hover">...'

And here is my jQuery:

The script is not applying any CSS to the list elements. I tried different combinations, tried to add a class to the a element by removing parent(), but nothing is triggering.

View 1 Replies View Related

JQuery :: Adding A Active Class To A Link?

Nov 15, 2010

I have this script where if users click on a link it will show that particular link in a slideUp, slideDown effect. For example There are two links and Two divs.Both Divs are hidden to start. If the user clicks link 1, Div 1 will appear. If the user clicks link2 Div 1 will close and Div 2 will appear. how do I add a active state when the user clicks on each particular link.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html
xmlns
="http://www.w3.org/1999/xhtml"

[code]....

View 1 Replies View Related

JQuery :: Multiple Active Links On Same Class

May 9, 2011

I have a web page wich has several list like this one:

So several ul's list wich are inside severals divs of class <div class="languages_cont" >

I need to make active the first <a> of each one this ul's and it need to be done in Js (when i say active i mean the <a> text will become bolded, so right now i've been trying using a each but no luck yet, it only selects the first it encounters.

View 2 Replies View Related

JQuery :: Cycle Plug-In: Pager Active CSS Class Not Working

Jul 20, 2010

I'm using the cycle plug-in with an existing nav bar (2 buttons). It functions correctly -- but for some reason -- I can't get the corresponding nav button to change CSS class and show as highlighted.

jQuery:
$(document).ready(function() {
$('#slideShow').cycle({
fx: 'fade',

[Code]....

View 1 Replies View Related

JQuery :: HasClass / RemoveClass Bug - Set Add / Remove A Class Called 'active' To / From A Link That Is Clicked Within A DIV

Sep 12, 2011

I have a link as such:

[Code]...

In a nutshell, I need to set add/remove a class called 'active' to/from a link that is clicked within a DIV. So if the link has the class 'active' already assigned I need to remove it and vice versa however the issue I am having is that I have to double click the link in order for it to work!!

View 6 Replies View Related

Set The Class To Active When It Is Clicked?

Mar 6, 2009

I'm trying to make a tabbed navigation system, but I don't know how to set the class to active when it is clicked so that it displays differently.

<body>
<div id='tabs'>
<ul>
<li><a href='#'>Link1</a></li>

[Code]....

View 4 Replies View Related

JQuery :: Change Active Link In Accordion Menu?

Aug 16, 2011

I'm creating an accordion menu and need to make the link you click on go from saying "click here to view" to "close". The way I had to set up the accordion is making finding code that works very difficult. Here is my [code]...

View 4 Replies View Related

Assign Active Class To Link?

Dec 3, 2010

I have some problems with assigning a class to my included navagation menu. I would like to give the last clicked menu item a active class so I can style it but i have no clue how that works with javascript. as you can see i have three files two pages which included the same menu. Now I would like to set the first page to active because it would be the page the would start. but then when someone clicks the second page it should become inactive and set the active class to the secone link.

[Code]...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved