CyberShot Posted December 20, 2009 Share Posted December 20, 2009 I am trying to set up options for my website. So that I can write code to make the site do stuff based on weather or not that particular option is selected. I tried doing it this way var slide = 1; if(slide == 1) { slide(); } function slide() { some code here } but it doesn't work. How can I get this to work? What is the best way. I am going to use jquery to set up a series of animation. Like slideUp, slideDown..ect.. ect.. So at the top of my code, I want to be able to activate the animation I want by either setting true or false. Like this slideUp = true; slideDown = false; slideLeft = false; slideRight = false; that way I can pick what animation I want by simply changing the the false to true. Can you help with a code example? Link to comment https://forums.phpfreaks.com/topic/185739-help-with-functions/ Share on other sites More sharing options...
trq Posted December 20, 2009 Share Posted December 20, 2009 The example you have should work, you might want to show us the actual code that doesn't work. Link to comment https://forums.phpfreaks.com/topic/185739-help-with-functions/#findComment-980759 Share on other sites More sharing options...
CyberShot Posted December 20, 2009 Author Share Posted December 20, 2009 $(document).ready(function(){ $(".downloadLink").hover(function(){ $(".downloadIcon").attr({src : "images/downloadIcon_Hover.png"}); }, function(){ $(".downloadIcon").attr({src : "images/downloadIcon.png"}); }); var slide = 1; if(slide == 1) { slide(); } function slide() { $("#about").click(function(){ $(".contentboxes").hide(); $(".contentboxes:eq(0)").show("2000"); }); $("#social").click(function(){ $(".contentboxes").hide(); $(".contentboxes:eq(1)").show("2000"); }); $("#work").click(function(){ $(".contentboxes").hide(); $(".contentboxes:eq(2)").show("2000"); }); $("#contact").click(function(){ $(".contentboxes").hide(); $(".contentboxes:eq(3)").show("2000"); }); } }); Link to comment https://forums.phpfreaks.com/topic/185739-help-with-functions/#findComment-980790 Share on other sites More sharing options...
CyberShot Posted December 20, 2009 Author Share Posted December 20, 2009 well, I think I figured it out. I changed the name of the variable to a different name from the function and how it is working. I can not mark the topic solved because I get an error every time. Something about session time out Link to comment https://forums.phpfreaks.com/topic/185739-help-with-functions/#findComment-980801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.