Keeping 'on' State Active On Page?
Nov 7, 2010
At the link below I've built the nav using CSS (see code below). How do I make the 'on' state stay active on each specific page? (i.e the 'about us' rollover image stays active on the 'about us' page)
[URL]
CSS:
/* -----------begin nav layout styles-------------- */
#navigation {
width: 455px;
height: 116px;
[Code].....
View 4 Replies
ADVERTISEMENT
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
Jun 20, 2007
Right now, I have multiple draggable windows on my site. The problem is, that only the most recently created box is draggable and I clicking the other box doesn't work.
Where you can click and drag different boxes. The problem is I don't know how to implement this. When the two boxes are up and I click on one box, it completly ignores the other box. I realize in my code I need to update widget1 but I'm not entirely sure how I can do that. I call the method below using: document.onmousedown=selectMouse; in my javascript
If it helps, the windows are all contained in a <div> tag with the id 'closewid'
Each of the new windows that opens had the id "widget"+a number.
46 function selectMouse(e)
47 {
48 if(firefox)
49 {
50 var p=e.target;
51 if(p.attributes['id'] && p.attributes['id'].value=="titlebar")
52 {
53 //document.write(p.attributes[0].nodeValue);
54 isDrag=true;
55 x=e.clientX;
56 y=e.clientY;
57 tx=parseInt(document.getElementById('widget1').style.left);
58 ty=parseInt(document.getElementById('widget1').style.top);
59 }
60 }
61 else
62 {
63 var p=event.srcElement;
64 if(p.attributes['id'] && p.attributes['id'].value=="titlebar")
65 {
66 isDrag=true;
67 x=event.clientX;
68 y=event.clientY;
69 tx=parseInt(document.getElementById('widget1').style.left);
70 ty=parseInt(document.getElementById('widget1').style.top);
71 }
72 }
73 }
View 1 Replies
View Related
Jun 28, 2009
i have a list of thumbnails that are created dynamically from a database which have an transparency state when the thumbnail is in the active state (ie when someone clicks on it)I wondered is there anyway that the first one could be set to active by default when the page initially loads. My code is below:
<script language="JavaScript" type="application/javascript">
<!--
function setMainImage(imageId) {
[code]....
I wonder how I can highlight the active thumbnail so its background remains blue until I click another one.I also like to avoid the inline JavaScript.
View 10 Replies
View Related
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
Jul 26, 2009
I'm quite new to web design and Javascript in particular. How to resolve a problem with the navigation bar in a website I am currently working on. The navigation bar has 3 main categories and there is an 'active' state so the page currently viewed is shown as grey underline text in the navigation bar. The thing is, I also have sub-categories that are not included in the navigation bar but I'd like to make it so the sub-category page currently being viewed makes the main category to which it is attached showing as 'active' in the navigation bar.
This is the structure of my site:
index.html
contact.thml
illustration
index.html
illustrationproject1.html
illustrationproject2.html
illustrationproject3.html
photography
index.html
photography1.html
photography2.html
So for example, if I'm in illustrationproject1.html, the Illustration tab in the navigation bar should be on the active state. This is the code I have so far:
Navigation Bar:
[CODE]
<ul id="nav">
<li class="nav_item"><a href="illustration/index.html">Illustration</a></li>
<li class="nav_item"><a href="photography/index.html">Photography</a></li>
<li class="nav_item"><a href="design/index.html">Design</a></li>
<li class="nav_item"><a href="stories/index.html">Stories</a></li>
<li class="nav_item"><a href="profile.html" title="Profile">Profile</a></li>
<li class="nav_item"><a href="contact.html" title="Contact">Contact</a></li>
<li class="nav_item"><a href="links.html" title="Links">Links</a></li>
</ul>
[ICODE]
This is the Javscript for the active state:
[CODE]
function setActive() {
aObj = document.getElementById('nav').getElementsByTagName('a');
for(i=0;i<aObj.length;i++) {
if(document.location.href.indexOf(aObj[i].href)>=0) {
aObj[i].className='active';
}}}
[ICODE]
So this code is working but I'm just not sure how to apply it to the subcategories as well. I can see what I should do, write some "if" statement but I don't enough of Javascript yet for this...
View 2 Replies
View Related
Nov 8, 2010
On the iphone I can keep a object on the top of the page by using the following in a interval:
Code:
document.getElementById('object').style.top = window.pageYOffset+'px';
I cannot figure out how to keep it at the bottom (to replicate fixed positioning)
View 4 Replies
View Related
Aug 4, 2010
I would like the page to not refresh and jump to the top of the page after they submit there answer. So on questions that use radio buttons I have been using
<input type="submit" value="Submit" onclick="get_radio_value(); return false;" />
for the submit buttion and that works perfect. I try and use it on questions that use checkboxes and it doesnt work so as a work around I am using the form's action attribute to set it to a link on the page. Here is my form code:
<form name="question2" action="#q2">2. <strong>Multiple choice:</strong><a name="q2"></a> Which patient or patients could be transferred to another hospital under the EMTALA Act?<br /> <input type="checkbox" value="a" name="aquestion" />Smith, Bill<br /><input[code]....
View 6 Replies
View Related
Jan 23, 2007
I am trying to make a floating "drag-able" navigation box that will seem not to reload between pages. I hope this make sense
The navigation is in a floating box that can be dragged as well as collapsed. And when you go from page to page the box will remain in the same location and in the same state (open or collapsed) ultimately creating the illusion that the nav box doesn't reload. Can this be done with JS? If so is the way to maintain the location with cookies or is there another way?
View 2 Replies
View Related
May 19, 2011
I'm trying to use the cookie plugin to remember the state of a navigation menu from page to page. Here is the snippet of code from towards the top of my page where I am including the jquery files and cookie plugin. The second part of the sample tries to determine whether the cookie exists.
[Code]....
View 1 Replies
View Related
Aug 20, 2009
I posted a similar thread about this in the .NET forum, but I thought maybe there was a javascript way of doing what I need to do.Is there a way to redirect a user to another page while keeping the passed in #parameter?For example, if the user clicks the link:
page1.html#event1
Can I redirect to:
page2.html#event1
Basically keeping the #parameter in tact?
View 1 Replies
View Related
May 4, 2011
I am currently using:
$("ul.tabs li:first").addClass("active").show();
$(".tab_content:first").show();
$("ul.tabs li").click(function() {
$("ul.tabs li").removeClass("active");
[Code]....
There are 2 options I could use but I don't know how to do it.
1. Using a get parameter to select the tab
2. Using the cookie plugin (not sure how that works)
View 4 Replies
View Related
Jun 8, 2011
getting all the header text:jQuery("#accordion h3").text();how do you get the active index? and how do you use that index to get the active header?how do you get the header text for the active header?
View 1 Replies
View Related
Nov 1, 2011
I used the code from the following article...[URL]
$(function() {
$('img[data-hover]').hover(function() {
$(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover',
[code]...
why does the rolled over image's src return to the original value when the user rolls back off it?
View 1 Replies
View Related
Jul 21, 2011
To say I'm new to JavaScript is a bit of an understatement so bear with me. I have a site set up with a variety of layers of toggles. When you enter the site all of the items are collapsed and you click the headings to expand. Each of the toggle-able items have ids. It works great for users who start at the homepage.
However, when I send people to any of the inner topics, all they see is the initial collapsed state of the site. I want to be able to provide a URL that will set the toggle to open, and show all of the content for that section on entry.
Here is my code and js, can anyone point me in the right direction?
[Code]....
View 2 Replies
View Related
Jun 1, 2010
How can I preserve the session state of a SharePoint browser state using javascript?
View 2 Replies
View Related
Jan 18, 2006
I have written a function that adds up numeric values from a multiple
textfields on a page and writes the sum to the total textfield. I would like
to move this from the page to an include so I can re-use on multiple pages.
How do i reference the active page in my script. This is an excerpt from the
function...
<script type="text/javascript">
function calctot(section)
{
if (section == "A")
{
/* Section A1 */
A = (document.frmSRData.A_BCI_RI_Public_Prod.value * 1) +
(document.frmSRData.A_BCI_RI_Public_Perf.value * 1);
document.frmSRData.A_BCI_RI_Public_SubTot.value = A;
B = (document.frmSRData.A_BCI_RI_Private_Prod.value * 1) +
(document.frmSRData.A_BCI_RI_Private_Perf.value * 1);
document.frmSRData.A_BCI_RI_Private_SubTot.value = B;
....
Do i need to pass a parameter to the function for the active page?
View 1 Replies
View Related
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
Jan 3, 2012
I am new to jQuery and have managed to create a tabbed interface with 4 sections. When the page loads, the tab content of section 1 shows up and the user can click on the others links to show other sections. In other words, tab 1 is always the first to be "active." However, I want to have a random "active" tab every time the page loads, so that other sections can be "active" as well randomly. Once the page loads with the random active tab, then the user can click to look at other sections.
<body>
<div id="tabs">
<ul>
<li><a href="#1">Tab One</a></li>
<li><a href="#2">Tab Two</a></li>
<li><a href="#3">Tab Three</a></li>
<li><a href="#4">Tab Four</a></li>
</ul> .....
View 1 Replies
View Related
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
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
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
Feb 24, 2006
I need to detect if page loaded or not with a script (in a child
frame). The IE has a special readyState function, is there anything
similar for Mozila browsers?
View 1 Replies
View Related
May 24, 2011
I have jquery issue, Kindly see my jquery code:
[Code]...
My .toggle_container is first time hidden, its good. BUT when I click on the link inside .toggle_container and navigate to another page or when page is load then my .toggle_container become hidden. I want to make it visible/open state. Can you please provide me any solution?
View 4 Replies
View Related
Dec 15, 2008
I'm stuck with a simple jquery accordion script that is[URL]..The problem is that there are links inside my divs that brings to another page where the same accordion menu should be included and left opened at the same state like the previous page (hope to be enough clear. The script I'm using will always close all the accordion divs upon the second page load. I'm a total newbie of jquery and couldn't understand exactly how jquery works (among other things I've to do i promise that I will learn jQuery as soon as possible );
[Code]...
View 2 Replies
View Related
Apr 11, 2010
I have a jQuery script which shows a specified div based on the select chosen from the dropdown list.The problem im having is how to retain the div state after the page has been posted and then returned too,
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
[code]....
View 5 Replies
View Related