Go Back   CodingForums.com > :: Client side development > HTML & CSS

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 12-05-2012, 09:40 PM   PM User | #1
wowdavid2002
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
wowdavid2002 is an unknown quantity at this point
on hover load content into div?

hey guys, i'm trying to figure out how to load content into content.div when you hover or click on this <a href>Link</a> instead of loading a new page. is there a way to do this?

here is the html code i have for now. i'm sure its bad.. i'm a super noob now

Code:
<div class="container">
   <div class="sidebar1">
	    <ul id="nav">
         <li><img src="images/logo.png" name="bar" width="170" height="95" id="bar" /></li>	

			<li> <a href="#" id="Boom">Home</a> 
		
			<li><a href="#">Projects</a>
				<ul>
					<li><a href="#">Ratis Grief </a>
		
						<ul>
					</ul>
					</li>
					<li><a href="#">Construction</a>
						<ul>
		
						</ul>
					</li>				<li><a href="#">Nights</a>
						<ul>
		
						</ul>
					</li>
					<li><a href="#">Portraits</a></li>
							<li><a href="#">Geometry</a> 
						<ul>
		
						</ul>
					</li>
					<li><a href="#">Fleets</a></li>
		
			  </ul>
		  </li>
            
		
			<li><a href="#">Statement</a>
				<ul>
		
				
				</ul>
			</li>
            	<li><a href="#">Contact</a>
				  <ul>
		
				
				</ul>
			</li>
		
		</ul>
	
	</div><div class="content"></div>

Last edited by wowdavid2002; 12-05-2012 at 09:47 PM.. Reason: posting code
wowdavid2002 is offline   Reply With Quote
Old 12-05-2012, 10:01 PM   PM User | #2
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Simple google search

Code:
<a>Hover over me!</a>
<div>Stuff shown on hover</div>
Code:
div {
    display: none;
}

a:hover + div {
    display: block;
}
Example of the following: http://jsfiddle.net/Vqmaw/

This method uses CSS you can do it with Jquery etc.
tempz is offline   Reply With Quote
Old 12-05-2012, 11:17 PM   PM User | #3
wowdavid2002
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
wowdavid2002 is an unknown quantity at this point
how would i assign it to open into a specific div?
wowdavid2002 is offline   Reply With Quote
Old 12-05-2012, 11:21 PM   PM User | #4
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Change "div" to what ever you want? Update it in the css.
tempz is offline   Reply With Quote
Old 12-06-2012, 12:21 AM   PM User | #5
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
For more advanced interaction you need JavaScript. Loading content into the page asynchronously (i. e. at a time other than on general page load) is done with a method commonly called “AJAX”. The search engine of your choice will tell you more.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 12-06-2012, 03:28 AM   PM User | #6
wowdavid2002
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
wowdavid2002 is an unknown quantity at this point
yea.. i was able to find a jquery that would load the divs, but then it stopped working once i used it with the mootools scripts i need for my menu. in way over my head now!
wowdavid2002 is offline   Reply With Quote
Old 12-06-2012, 05:01 PM   PM User | #7
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Yeah, that’s what I wrote this sticky thead for. If you insist in using mootools I’m sure it also has some AJAX functions. But in any case, AJAX is plain old JavaScript, you don’t need jQuery or mootools at all to do that (although they make things easier).
__________________
Don’t click this link!
VIPStephan 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 02:59 AM.


Advertisement
Log in to turn off these ads.