"jQuery for Absolute Beginners” Video Series complete, what next?

Martin have a read through the official docs and then start writing some code. Perhaps make a practice website implementing lots of the JQuery functions.
 
Yeah, the jQ official documentation is very very good - far better than any other framework I've ever used, which makes learning and using it much easier.
 
I quite agree with msm722. Start using it even if it's just messing around. The more you use it, the easier it becomes. You'll learn far more using it than you will reading about it.
 
E.g. get your teeth into a project. A lot of people learn a lot by actually using it to solve a practical problem.

Ohhh i see.
I was actually thinking about doing that but i thought i would like to learn a little more first.

Do you have any work? I'd love to see.
 
I did this a while back when i was testing out the drag/drop and AJAX features.

TBH I think the best way to learn something is by doing. All the theory in the world isn't going to help if you've never actually built anything in anger :)
 
Ok this is how new i am. Its not perfect which i am aware of so please don't be to harsh. Click on the link below for a tester.

http://www.every-occasional-videos.co.uk/jquery

How do i change this so that when you click a second link it removes the first content?

Here is my code

Code:
$(function() {
		   $('a#home').click(function() {
									  $('#box').fadeIn(4000);
									  });
		   
		   		   $('a#news').click(function() {
									  $('#box2').fadeIn(4000);
									  });
				   
				   		   $('a#about').click(function() {
									  $('#box3').fadeIn(4000);
									  });
						   				   		   
												   $('a#link').click(function() {
									  $('#box4').fadeIn(4000);
									  });	
												   
		   });
 
You can fix it using a custom function:

Code:
<script type="text/javascript">
	
	$(function() {
		$('a#home').click(function() {
			showContent('#box');
		});
		   
		$('a#news').click(function() {
			showContent('#box2');
		});
				   
		$('a#about').click(function() {
			showContent('#box3');
		});
						   				   		   
		$('a#link').click(function() {
			showContent('#box4');
		});
	});
	
	function showContent(box) {
		// Hide all of the boxes
		$('.content').hide();
		// Fade in the specified box
		$(box).fadeIn(4000);
	}
	
</script>

You will need to add a class to all of the divs in the body so they can be hidden with a single selector:

Code:
<div id="box" class="content">
<div id="box2" class="content">
<div id="box3" class="content">
<div id="box4" class="content">
 
You can fix it using a custom function:

Code:
<script type="text/javascript">
	
	$(function() {
		$('a#home').click(function() {
			showContent('#box');
		});
		   
		$('a#news').click(function() {
			showContent('#box2');
		});
				   
		$('a#about').click(function() {
			showContent('#box3');
		});
						   				   		   
		$('a#link').click(function() {
			showContent('#box4');
		});
	});
	
	function showContent(box) {
		// Hide all of the boxes
		$('.content').hide();
		// Fade in the specified box
		$(box).fadeIn(4000);
	}
	
</script>

You will need to add a class to all of the divs in the body so they can be hidden with a single selector:

Code:
<div id="box" class="content">
<div id="box2" class="content">
<div id="box3" class="content">
<div id="box4" class="content">

Thanks mate! because of the 'showContent('#box4');' is this what removes the content when you click onto another link?

Its for beginners of Jquery only. Would you like to have the link?
 
Martin_Man said:
because of the 'showContent('#box4');' is this what removes the content when you click onto another link?
In a rounadbout way yes. showContent is just the function, the line which actually hides all the boxes is $('.content').hide();.
 
Back
Top Bottom