View Full Version : blind and fade, then go to URL
mistersmith307820
04-14-2009, 12:02 PM
Hello,
I am quite new to JS...
What I want to accomplish is when a link is clicked it activates
spry blind and fade
and THEN the go to URL.
So, is there a way to delay the link function?
If it blinds for 1000ms and simultaneously fades at 800ms,
I want the link to occur at 1000ms
I found a site that does this (http://hallassociates.ca/) and used SiteImport to examine their javascript
but it is above my comprehension...
Thanks!
Donovan
Justin Nemeth
04-14-2009, 12:11 PM
Sounds like you can use the setTimeout() function. That will allow you delay execution for your url redirect. You probably want something like this:
//your blind and fade code
setTimeout('urlFunction', 1000);
That would wait 1 second (1000 milliseconds) then call urlFunction(). For more info check out this: http://www.w3schools.com/js/js_timing.asp
mistersmith307820
04-14-2009, 12:45 PM
I have fiddled around with adding that code and it still does not seem to work.
Here is the example i am messing with (only has blind, no fade)
-->
</style>
<script src="SpryAssets/SpryEffects.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
function MM_effectBlind(targetElement, duration, from, to, toggle)
{
Spry.Effect.DoBlind(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body class="oneColFixCtr">
<div id="container">
<div id="mainContent" onclick="MM_effectBlind(this, 1000, '100%', '0%', false);MM_goToURL('parent','index.html');return document.MM_returnValue">
<h1> level heading </h1>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent aliquam, justo convallis luctus rutrum, erat nulla fermentum diam, at nonummy quam ante ac quam. Maecenas urna purus, fermentum id, molestie in, commodo porttitor, felis. Nam blandit quam ut lacus. Quisque ornare risus quis ligula. Phasellus tristique purus a augue condimentum adipiscing. Aenean sagittis. Etiam leo pede, rhoncus venenatis, tristique in, vulputate at, odio.</p>
<!-- end #mainContent --></div>
<!-- end #container --></div>
</body>
</html>
where do I add it?
thanks!
Ray Borduin
04-14-2009, 12:47 PM
onclick="MM_effectBlind(this, 1000, '100%', '0%', false);setTimeout('MM_goToURL(\'parent\',\'index.h tml\')',2000);return document.MM_returnValue"
mistersmith307820
04-14-2009, 12:49 PM
thank you so much!
works perfect!
I love the WA forums. I started from scratch and have learned so much!
thanks again!
gruant2000381341
12-01-2009, 05:33 PM
this is pretty neat, I followed the posts above and got one working. How can I apply this to a text link, so I can have a few different links on the same page. Example clickk here to go to page r and click here to go to page j. Then when clicked, I will get the blind effect and redirection to the coresponding page
I have tried to copy the code and apply it to a href tag but that didnt work. Any ideas?
<a href="#"onclick="MM_effectBlind(this, 1000, '100%', '0%', false);setTimeout('MM_goToURL(\'parent\',\'index.h tml\')',1500);return document.MM_returnValue" >
Ray Borduin
12-04-2009, 06:57 AM
maybe try:
<a href="javascript:MM_effectBlind(this, 1000, '100%', '0%', false);setTimeout('MM_goToURL(\'parent\',\'index.h tml\')',1500);return document.MM_returnValue" >
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.