I am very new to jquery and am wondering how to combine jquery functions. Right now, my code is a bit of a mess! I've done some research and haven't been able to keep it functioning properly when I combine functions. I don't want to keep my code looking like this, but at least for now it is working properly (except in Firefox). What is the best practice for combining functions?
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery("#music").click(function () {
jQuery("#musicinfo").slideToggle('slow');
jQuery("#fpinfo, #behindinfo, #behindinfo, #signupinfo").hide('slow');
});
});
});
</script>
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery("#fproduct").click(function () {
jQuery("#fpinfo").slideToggle('slow');
jQuery("#musicinfo, #behindinfo, #behindinfo, #signupinfo").hide('slow');
});
});
});
</script>
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery("#behind").click(function () {
jQuery("#behindinfo").slideToggle('slow');
jQuery("#fpinfo, #musicinfo, #signupinfo").hide('slow');
});
});
});
</script>
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery(".exit").click(function () {
jQuery("#behindinfo, #musicinfo, #fpinfo, #signupinfo").hide('slow');
});
});
});
</script>
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery("#signup").click(function () {
jQuery("#signupinfo").slideToggle('slow');
jQuery("#fpinfo, #musicinfo, #behindinfo").hide('slow');
});
});
});
</script>
<script type="text/javascript">
$( document ).ready(function() {
jQuery(function(){
jQuery(".exit").click(function () {
jQuery("#behindinfo, #musicinfo, #fpinfo, #signupinfo").hide('slow');
});
});
});
</script>
<script>
$('#behind, #fproduct, #music, #signup').click(function(){
var divLoc = $('#top').offset();
$('html, body').animate({scrollTop: divLoc.top}, "slow");
});
</script>