Jump to content

help with functions


CyberShot

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.