Jump to content

Recommended Posts

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

$(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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.