Derleek Posted August 6, 2008 Share Posted August 6, 2008 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> Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted August 6, 2008 Share Posted August 6, 2008 Throw in a return false; Statement at the end of your callSlideOut() function. That should disable the default action of the browser following the link. Quote Link to comment Share on other sites More sharing options...
Derleek Posted August 6, 2008 Author Share Posted August 6, 2008 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 Quote Link to comment Share on other sites More sharing options...
Derleek Posted August 8, 2008 Author Share Posted August 8, 2008 any one help me with this issue? still can't figure it out... Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 8, 2008 Share Posted August 8, 2008 <a href= 'page2.html' onclick='callSlideOut(); return false;'>Page2</a> Try that. >_< Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.