Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-07-2013, 04:11 PM   PM User | #1
turpentyne
Regular Coder

 
Join Date: Aug 2010
Posts: 315
Thanks: 10
Thanked 1 Time in 1 Post
turpentyne is an unknown quantity at this point
jquery text navigation

Hi...

Getting used to jquery, and I'm only on a basic level with javascript.

I'm taking over somebody else's code, and trying to change some navigation to be text instead of images so it's easier to edit. But it seems a little more complicated than it should be? I can't just delete the image and put in text. Nothing appears? Right now it's doing an image switch for the rollover. I just want to do a simple CSS change on mouseover.

Here's what it looks like right now:

The html (and css, if needed to look at):
Code:
<div id="navigation">
			<ul class="navigation">
				<li class="nav-history"><img src="images/nav_01.gif"/></li>
				<li class="nav-neighbourhood"><img src="images/nav_04.gif"/></li>			
				<li class="nav-team"><img src="images/nav_05.gif"/></li>
			</ul>
		</div>
Code:
#navigation{
	position:absolute;
	width:974px;
	height:24px;
	left:0px;
	top:4px;
	opacity:0;
	display:none;
}

#navigation ul{
	font-size: 0;
	display:inline-block;
	list-style-type: none;
	border:0px;
	padding:0px;
	margin:0px;
}

#navigation ul li{
	cursor:pointer;
	display:inline-block;
	border-collapse:collapse;
	border-left:0px;
	border-right:0px;
	border-spacing:0px;
	list-style-type: none;
	padding:0px;
	margin:0px;
}
Here's the snippet of Jquery I'm trying to change to deal with text, not images

Code:
$('.nav-history').click(function(){
		$("#slider-container").stop().animate({left: '0'}, 1000, "easeOutQuint");
		
		$('.nav-history img').attr('src', 'images/nav_01.gif');
		$('.nav-neighbourhood img').attr('src', 'images/nav_04.gif');
		$('.nav-team img').attr('src', 'images/nav_05.gif');

	});
turpentyne is offline   Reply With Quote
Old 03-08-2013, 01:41 PM   PM User | #2
harbingerOTV
Senior Coder

 
Join Date: Jan 2005
Location: Memphis, TN
Posts: 1,769
Thanks: 8
Thanked 127 Times in 125 Posts
harbingerOTV will become famous soon enough
Code:
#navigation ul{
	font-size: 0;
Looks like it could be your culprit.

And you are adding a link right?, eg:

Code:
<ul class="navigation">
<li class="nav-history"><a href="">LINK TEXT</a></li>
...
Once you remove the image it self, the jQuery will have nothing to target:
Code:
$('.nav-history img').attr('src', 'images/nav_01.gif');
__________________
Stop making things so hard on yourself.
i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis
harbingerOTV is offline   Reply With Quote
Old 03-14-2013, 03:05 PM   PM User | #3
aliravan
New to the CF scene

 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
aliravan is an unknown quantity at this point
thanks
aliravan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:18 PM.


Advertisement
Log in to turn off these ads.