View Full Version : How To Apply an "effect" a certain number of times?

02-18-2006, 05:16 PM
I am relatively new to using DHTML and I found these scripts very useful

I do have one question.

Currently I am working with this script


Now this question isn't specific to this effect but I'll use it as an example

When you enter the page it gives you a cool boxing in effect. However, I wanted to use it on a page that has thumbnails. So obviously whenever you click the thumbnail, look at the larger jpg, then go back, you get the boxing in effect again.

Again this can get annoying.

Now I found other scripts here that have cool effect, but I don't want to use them too often.

I tried to write a cookie for this above effect, and it did work, it let me apply it three times for the session, but does anyone have any idea how to do something GENERIC. (First of all my cookie skills aren't great):)

I guess I am looking for a "cookie" or another way to do this so I can apply it to all effects or easily modify it to any effect here, so that my visitors will only see the, say boxing in effect, maybe the first three times they click on the page, then it goes away for, say a day.

Any ideas, or is this gonna get way too complicated?

02-18-2006, 05:54 PM

function doit(){
if(document.referrer.indexOf(window.location.host) != -1) return;
window.scrollTo(0,0)This disables the effect if the user isn't coming from another page on your site. Not quite what you asked for, but it should serve, generally speaking.

Other than that, I'm afraid it's back to cookies :)

02-18-2006, 06:56 PM
Thanks I tried it but I can't get it to work

Shame, 'cause it's a cool effect, it just is gonna drive people nuts

There's got to be a simpler way to write a cookie.



02-19-2006, 12:14 AM
Ok after running hit and miss with my homemade cookie I ran across this effect


This sticky note effect seems to be able to be applied radomly or once per session.

I was working at adapting the code in it for the "box in" effect.

Not very experienced here.

You think that would work?