Jump to content

running code after link is clicked


Derleek

Recommended Posts

Ok, so i am using the mootools framework.  I'm trying to run Fx.slide (

http://demos.mootools.net/Fx.Slide

), and have a content div slide up before the browser switches pages.

 

I tried using a onclick ='callSlideOut()' in the <a> tag but it follows the link before it runs the function.

 

Javascript:

function callSlideOut(){
	slideThis.slideOut()
	setTimeout(500);
}

 

html link:

<a href= 'page2.html' onclick='callSlideOut()'>Page2</a>

Link to comment
https://forums.phpfreaks.com/topic/118469-running-code-after-link-is-clicked/
Share on other sites

go the same result...

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<script type="text/javascript" src="mootools.js"></script>
	<script type="text/javascript">
window.addEvent( 'domready', function(){
var slideThis = new Fx.Slide('content')

window.onload = function slidingIn(){
	slideThis.hide();
	slideThis.slideIn();
}

function callSlideOut(){
	slideThis.slideOut();
	setTimeout(500);
	return false;
}
} );

	</script>
	<title>FX.slide</title>
</head>
<body>
<a href= 'page2.html' onclick='callSlideOut()'>Page2</a>
<div id= 'content'>
	DSKFJLSDLFKJSDLKFJSLDKJF SDLFKJSDKJSDF SDLKFJSLDKFJLSDKFJ SLDKFJSLDKJF lSKDJFLSDKJFLSDKJF lKSDJFLKSJDFLKSDJF
</div>

</body>
</html>

 

here is the whole page. figured it's small enough to post

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.