Jump to content

Jquery calling function


manix

Recommended Posts

Heya

 

I need to call a function in straight text just like that and I seem to be having trouble managin in Jquery..

 

Here's an example

 

$(document).ready(function(){

 

function MyFunc()

{

stuff stuff

}

 

if(somecondition){call function here)

 

});

 

how do I do that?

Link to comment
Share on other sites

	var CurPic = 1;

function Previous(){
CurPic--;
if (CurPic==0) {CurPic=5;}
$("#picslot").attr("src", CurPic+".jpg");
}

function Next(){
CurPic++;
if (CurPic==6) {CurPic=1;}
$("#picslot").attr("src", CurPic+".jpg");
}

$("#larrow").click(Previous);
$("#rarrow").click(Next);

$("body").bind('keydown',function(e) {

var keypressed = e.which
switch(keypressed)
{
case 37:
Previous;
break;

case 39:
Next;
break;
}

});

 

this is a picture slider kind of thingy ...

Link to comment
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.