Jump to content

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

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.