javascript - Combine Multiple Jquery Functions into single function -


I am very new to jquery and am wondering how to combine the jquery function. Right now, my code is a bit of a mess! I have done some research and when I combine the function, I can not keep it properly. I do not want to show my code this way, but at least now it is working properly (except Firefox). What is the best practice for combining functions?

  & lt; Script type = "text / javascript" & gt; Click (function () (jQuery ("# ​​musicinfo"), Slide Toggle ('Slow'); jQuery ("#Fpinfo, #behindinfo, #behindinfo, #signupinfo"). Hide ('Slow');}) ;});}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {jQuery (function () {jQuery ("# ​​fproduct") Click (function () {jQuery ("# ​​fpinfo"). Slide Toggle ('Slow') ; JQuery ("# ​​Musicinfo, #behindinfo, #behindinfo, #signupinfo") Hide. ('Slow');});});}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {jQuery (function) {jQuery ("# ​​back") Click (function () {jQuery ("# ​​behindinfo") Slide Toggle ('Slow'); jQuery ("#Fpinfo, #musicinfo, #signupinfo"). Hide ('Slow');});});}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {jQuery (function () {jQuery ("exit") Click (function () {jQuery ("# ​​behindinfo, #musicinfo, #fpinfo, #signupinfo"). Hide ('slow');});});}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {jQuery (function () {jQuery ("# ​​signup") Click (function () {jQuery ("# ​​signupinfo") Slide Toggle ('Slow'); JQuery ("#Fpinfo, #musicinfo, #behindinfo"). Hide ('Slow');});});}); & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {jQuery (function () {jQuery ("exit") Click (function () {jQuery ("# ​​behindinfo, #musicinfo, #fpinfo, #signupinfo"). Hide ('slow');});});}); & Lt; / Script & gt; & Lt; Script & gt; $ ('#birth, #fproduct, #music, #signup'). Click (function () {var divLoc = $ ('# top') offset (); $ ('html, body'). ScrollTop: divLoc.top}, "slow");}); & Lt; / Script & gt;  

Something like this:

  & lt; Script type = "text / javascript" & gt; Click JQuery ("#Music") (function () {jQuery ("# ​​musicinfo"), Slide Toggle ('Slow'); jQuery ("#FPINNO, #Hhind Info, # (" Slow "(Slow");) () "jQuery" ("slow");) ("# fproduct") Click (function () {jQuery ("# ​​fpinfo"). Slide Toggle ('Slow'); jQuery (" Click on "slow" ();) () "jQuery" ("# back") (function () {jQuery ("# ​​behindinfo") Slide Toggle ('Slow' ("#." (" #fpinfo, #musicinfo, #signupinfo "). Hide ('slow');}); jQuery (" exit. "). (Function () {jQuery (" # behindinfo, #musicinfo, # JQuery ("# Signupinfo"). ("Slow");) () "jQuery" ("#signup") Click on the slide ("(slow. Function () {jQuery ("# ​​back information, # musicinfo, #phiniffo, #signupinfo") .hide ('slo w');}); $ ('#birth, #fproduct, #music, #signup') Click (function () {var divLoc = $ ('# top') offset (); $ ('html, body'). ScrollTop: divLoc.top}, "slow");}). }); & Lt; / Script & gt;  

Comments