Create a peeling corner on your website

Peeling a webpage is very fun to do and it'll draw attention from your users. You can use to it place advertations, or draw attention to a hot article on your own website. Here I'll explain how to create such an effect on your website. It uses Flash and JavaScript, and is really easy to install. A live demo for the peeling effect can seen when you fully read this article.

Peeling Webpage

I received this package from the admin of musicincontrol.nl, a great dutch music website.

If you read this, you should be able to see the peeling live and working in the top-right corner of this page. When you mouse-over the image, it'll expand revealing more information.

To achieve this, simply execute the following steps to embed a peeling corner on your website.

The JavaScript

Select the code above and save it as peel.js (Download Download).

Now edit the file with your favorite programming editor (Notepad will work too). Search for the following code line:

jaaspeel.ad_url = escape('http://www.marcofolio.net/');

Change the value between the quotes (in this example it is "http://www.marcofolio.net/") to the webpage you want your corner to re-direct too, when people click on it. Save your peel.js file.

The images

As you can see in the JavaScript code, this effect uses two images.

  1. small.jpg A 100x100 px image, used when the peeling effect is inactive.
  2. large.jpg A 650x650 px image, will be shown when a user mouse-overs the peel.

In this example, I'm using this small.jpg and this large.jpg. Create your own images that will be shown in the peel.

The Flash

This project uses Flash to create the actual effect. To download the Flash files, look below and download the attached source files.

Upload files

Now you're all set to upload the files to your web server. Upload the following files:

  1. peel.js
  2. small.jpg
  3. small.swf
  4. large.jpg
  5. large.swf

to the following directory:

http://YOURDOMAIN.COM/peel/ 

Installing on your site

Now add the following line to your webpage. Make sure your source (src) direction is correct.

<script src="peel/peel.js" type="text/javascript"></script>

Well, that's about it. Refresh your page and you should have a nice peeling corner that you can update by just changing the images "small.jpg" and "large.jpg". If it doesn't work, you probably didn't set the paths correct. Please check and make sure it's the right path. Additionally, you can change all the parameters in peel.jpg, beginning with "jaaspeel." (Readme file included).

I'm not the one who created the code and I don't know who did. Please contact me if you know / are the programmer of this code.

Attached files:

Download Peel Package Source Peel

Troubleshoot

Due to some of the comments, I created a package that should work when you upload it. You can view how it should look like in the example/demo page.

Attached files:

Download Peel Troubleshoot Package Troubleshoot Peel

Flash Source

I'm not going to modify the code anymore. If you want to have a go, download the Flash source files and play around.

Attached files:

Download Peel Flash Source Files Source Peel

Where are you going to use the peeling package for?



Tags:  how to peel website webdesign

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Reddit!Del.icio.us!Facebook!Technorati!StumbleUpon!Newsvine!Furl!Ma.gnolia!
Comments
Add NewSearchRSS
Sean McGoldrick   | 89.125.97.xxx | 2007-10-31 14:29:13
Gravatar image This is fantastic! I've been looking for a free version of this script for some time. Thanks again.

http://AboutBlogging.Info
john doe - where is the demo   | 68.36.194.xxx | 2007-11-02 06:32:48
Gravatar image Yeah and where exactly is the demo?
Marco - re: where is the demo   | 62.194.192.xxx | 2007-11-02 08:29:43
Gravatar image
john doe wrote:
Yeah and where exactly is the demo?
Don't you see it? It's at the right-top corner of this page, it's already working and implemented here :)
john doe - whoops   | 68.36.194.xxx | 2007-11-02 21:38:49
Gravatar image Stupid adblock plus, thanks!
Lennart - SHo to link to current site _s   | 217.195.178.xxx | 2007-11-08 21:12:36
Gravatar image Hopw do we get it to not open a new window. We eant it to be able to open in the current window as with a standard url link target=_self

Cheers
Marco - Another "Large.swf"   | 62.194.187.xxx | 2007-11-10 10:46:52
Gravatar image Try downloading this Flash-file and replace it with the old one and try again.
Anonymous   | 213.231.101.xxx | 2007-12-02 16:40:56
Gravatar image I was looking for this too.

The replacement flash file does open in the same window, but the peel animation is transparent!
mellick - not happening for me   | 81.96.162.xxx | 2007-11-08 22:48:18
Gravatar image I have d/l all paths are have been checked and rechecked but I get nothing at all :cry:

I have failed to get it running on 2 windows and 1 linux server either locally or remotely.
Marco - Try same path   | 62.194.187.xxx | 2007-11-10 10:40:03
Gravatar image Try putting everything (.js + .swf + .jpg + your index file) in the same folder.

Remove all path redirections in the .js and script HTML code and try again.

You can also try linking everything with a "hard link".

Example:
Instead of:
Quote:
jaaspeel.small_path = '/peel/small.swf';

Make it:
Quote:
jaaspeel.small_path = 'http://YOURWEBSITE.com/peel/small.swf';


Good luck!
matt   | 121.45.24.xxx | 2007-11-10 14:21:27
Gravatar image thanks for the info - legend.
ben - something is definately wrong   | 86.54.83.xxx | 2007-11-12 16:26:28
Gravatar image I work as a full time web designer and thought i would give this a try as it would be a quick and easy way to introduce this effect, as I am a flash-aphobic if there is such a phrase.

I have used paths as supplied, relative paths, absolute paths and placed all files in same dir. I have even tried everything directly in the root dir but the swf is not even loading. I have downloaded twice as thought a file may have become corrupt. But to no avail :( :(

Obviously it has worked for some people - just not for me.
Dane H - great job, Thanks so much   | 70.16.111.xxx | 2007-11-12 16:34:24
Gravatar image WOW!
Thanks for the free page peel Marco. Everywhere else I looked wanted to charge, and here you are giving it away for free.
Because of that I would like to make a donation. Please contact me thru my contact form on my webpage so I can do so.

Thanks for being so generous with the code.

Dane H
http://hiddenhillsnursery.com
ben - I dont know what i was thinkin   | 86.54.83.xxx | 2007-11-12 16:46:39
Gravatar image I dont know what i was thinking, I just followed the instructions to place link to js file in tag, which was the problem. If I had been half awake I would have ignored it and placed it in the BODY. So much for being a pro eh.

Love the effect, if we use it on our site I will be more than happy to make a donation.

Thanks for great script.
Marco - Thanks Dane and Ben   | 62.194.187.xxx | 2007-11-12 17:13:56
Gravatar image Ben, Dane,

Thank you for your reactions. These comments show that there are people out there that really like my work. That is enough motivation for me to keep on doing this. No donation is needed, thanks anyway :) .

And Ben,
Even the best can make mistakes :wink:

Greetings,
Marco
Dane H - Very close, but.....   | 216.246.143.xxx | 2007-11-14 03:18:46
Gravatar image Hi Marco,
I am so close to getting it all to work. I am testing it on my computer before uploading, but I seem to be having a slight problem or two. I have saved all files to a folder, redirected all links (basically removing /peel/), and edited the re-direct url. I modified two images to replace the blank ones from the zip file, added the proper code into the HEAD ( although, looking at your page source here, you seem to have it in BODY... :D , and it looks like a comment???). When I open my index page, I see the corner rolled with my image, but it won't roll, and the url wont redirect. So very close...any ideas?

Dane H
http://hiddenhillsnursery.com
Marco - Good work   | 62.194.187.xxx | 2007-11-14 08:24:18
Gravatar image Hello Dane,

The one that looks like a comment is my "old" one, the proper one used on this page looks like this:
Quote:
src="images/stories/programming/webdesign/peel/peel.js"

Strange this about this script, is that it works in the HEAD and sometimes in the BODY. In Firefox it works on both, IE6 only when it's in the BODY. Putting it in the HEAD is better for performance, but sometimes it doesn't work.

Are you sure you made the proper changes to peel.js? If you see the "small.swf" (the small rolled image) and you mouse-over it, the "large.swf" should show up.

Did you also change the jaaspeel.big_path and jaaspeel.big_image in the .js file?

If it still doesn't work, try uploading it to your webserver. The .swf file tries to load the .jpg file and sometimes your localhost can see this is an "illegal operation". When it's online, it should work.

Good luck,

Greetings,
Marco
Dane H - Oh Well   | 216.246.143.xxx | 2007-11-15 23:26:01
Gravatar image I have tried everything I can think of, including loading all the files freshly unzipped into a folder named peel, placing the in my index code, uploading, and.....nothing. Tried hard coding too, and nothing. I can get the corner to start to roll when all files are on my comp, but when I upload, nothing. :confused:

I guess I will have to keep playing. :D

Dane H
http:hiddenhillsnursery.com
Marco - Troubleshoot package   | 77.249.210.xxx | 2007-11-16 10:15:59
Gravatar image Dane,

I edited my post and added a "peel_troubleshoot.zip". When you upload everything in that package in any folder, it should really work (Localhost can give permission problems). When it still doesn't work on your website, it can be your host that doesn't allow to connect the Flash with the JPG files.

Good luck, please tell me if it worked.

Greetings,
Marco
Erik - Excellent   | 71.223.4.xxx | 2007-11-21 07:03:25
Gravatar image Great job in the directions. Worked perfect the very first time.
Peter - Peter   | 62.166.5.xxx | 2007-11-26 09:51:39
Gravatar image Working perfect but I would like to open the link in the same window not in a new one. Is this possible and how? I looked at the java script and tried a few things but I can't get to work.

Any help would be great!
Jimbob - Align   | 88.108.234.xxx | 2007-11-27 19:57:07
Gravatar image Great script have added to a page but the image seems not to be aligned right even though it it 650x650?
Any help much appreciated.
http://www.france-rental.com/inc_default.asp?PageId=2
Jimbob - Ignore me   | 88.108.234.xxx | 2007-11-27 20:11:56
Gravatar image Ignore that last comment, I've fixed it now.
TS - How About....   | 88.109.78.xxx | 2007-11-28 05:06:22
Gravatar image Excellent, well done and thanks for making it available FOC.
As you are giving it away, how about also making flash source available?
Alternatively, how about adding a parameter which will allow me to determine whether or not my link opens in a new window OR replaces the page I'm on.

Best wishes...
Jimbob - How About 2...   | 81.144.152.xxx | 2007-11-28 13:53:19
Gravatar image I agree with TS, if you could make the flash source available that would be great..it would also mean we could resize the peel too. :lol:
Unless there is anopther way of resizing the peel?
shahid hussain - Z-index issue in home page usi   | 67.135.28.xxx | 2007-11-29 23:05:34
Gravatar image hi,
i have created a page and i use peelawayad file which is in flash. i was already using two div on home page which contains flash movies. but now when i placed peelawayad flash movie on home page. it appears on bottom of both div layers. i tired my best with stylesheet. z-index and many other tricks which i know best. but still not able to sucess. can someone help me to getride of this issue. help would be appriciated. thanks

here is the current site link which has the flash movies embeded.

http://www.visionetsystems.com/test/

Source Files are as under:
http://board.flashkit.com/board/attachment.php?attachmentid=64690&d=1196368726

thanks

Shahid Hussain
Marco - re:   | 62.194.187.xxx | 2007-11-30 11:16:44
Gravatar image @TS & Jimbob:
Right now, my laptop (with source files) has crashed and will return next week. When I have it back, I'll release the source code and you can play around with it.

@shahid hussain:
You're right, I had this problem too and wasn't able to fix it. Did you try putting the "peel code" (peel.js";) in the section of your website?

I'm sorry, but I really don't have any clue. Please come back if you found the solution!

Good luck.
Jimbob   | 88.108.195.xxx | 2007-11-30 12:22:23
Gravatar image Hi,

Actually I don't need the source now...to reduce the size of the peel without distorting you just need to keep the correct ratio between the large.jpg and the .swf file.

shahid hussain - I had similar problems with other flash on the page and this is the reason why I reduced the peel size so there is no overlap.
TS - RE: How About   | 88.109.78.xxx | 2007-11-30 14:12:46
Gravatar image
Quote:
@TS & Jimbob:
Right now, my laptop (with source files) has crashed and will return next week. When I have it back, I'll release the source code and you can play around with it.


:D Thanks Marco, that will be great, look forward to your releasing flash source.

Regards, TS
Shahid Hussain - Web designer   | 67.135.28.xxx | 2007-12-06 16:40:31
Gravatar image hi,
i have created a page and i use peelawayad file which is in flash. i was already using two div on home page which contains flash movies. but now when i placed peelawayad flash movie on home page. it appears on bottom of both div layers. i tired my best with stylesheet. z-index and many other tricks which i know best. but still not able to sucess. can someone help me to getride of this issue. help would be appriciated. thanks

here is the current site link which has the flash movies embeded.

http://www.visionetsystems.com/test/


Here is the Source Code i have been used in the website
Prasanna   | 121.243.253.xxx | 2008-05-15 14:10:31
Gravatar image Hai did u get the solution for this problem Even i have the same problem if u had solve the problem kindly help me out thanks
TS - RE: How about   | 88.110.114.xxx | 2007-12-08 02:48:31
Gravatar image Hi, Any luck yet with your bust computer? Hoping to be able to grab flash source code from you soon?

Regards TS
Dane H - PERFECT!!!   | 65.175.247.xxx | 2007-12-09 23:39:03
Gravatar image Congrats Marco,
The troubleshooter was the magic bullet. I downloaded both zip files and tried both...no luck on the original, but the troubleshooter worked like a charm. Now I just need to figure out how to modify my JPGs so I can replace yours with mine.

Thanks Marco
Paul - .   | 203.17.45.xxx | 2007-12-10 07:53:54
Gravatar image gday, great script, thanks alot.

it works great except when i change the .js you supplied to make the link open in the same page, i also get the transparent fold when i hover. iv tried all the tricks mentioned here and cant work it out.
any help would be great
Thanks again
Marco - Source added   | 62.194.187.xxx | 2007-12-10 15:00:53
Gravatar image Hi ya'll,

Got my laptop back. New motherboard + LCS screen + HDD did the trick.

I added the source files in the article, check it out. Good luck changing the code so that it'll work how you want it.

Sorry Shahid Hussain, but I can't help you. Maybe others know how this could be fixed.

Greetings,
Marco
TS - Flash Source   | 88.110.114.xxx | 2007-12-11 15:29:23
Gravatar image Hi Marco,

Many thanks for making flash source (large.fla) available.

Modifying large.fla and peel.js to cater for target frame for any ad is a simple step. However, it seems the act of loading the source into Flash CS3 Pro and re-publishing it (as flash 8, actionscript2) upsets the masking routines such that reflection of the ad is lost during the peel. The masking to give the relfection is beyond my flash skill level at present, Should anyone else with a more detailed understanding of such flash techniques be interested I'd be happy to colaborate?

Regards
TS
paul - help please   | 203.17.45.xxx | 2007-12-11 02:30:03
Gravatar image any help with the transparent fold on open would be great.
thanks
Paul
Paul   | 203.17.45.xxx | 2007-12-17 02:24:29
Gravatar image has anyone else been able to fix the above error?
Andrew - - solved open same window   | 67.183.10.xxx | 2007-12-17 10:50:41
Gravatar image @ TS - you're right. I believe the mess up is happening when the .swf is published to a newer version.

Okay, I don't think this has been said yet so here we go...since something is messing up when people are updating the .fla and .swf to make it open in the same window, I think this is what can fix it...

Marco:

In the Large.fla you provided, on frame 44 in the Action Layer there's this code:

bt.onRelease = function ()
{
getURL(_root.ad_url, "_blank";);
};


I think all you have to do is change "_blank" to "_top" , and then republish the .swf

Is there any way to donate money for all this effort, Marco? Even sending you a gift card or something...man...I'm very appreciative of this resource. Please let me know.

thanks!
andrew
Marco - re:   | 62.194.187.xxx | 2007-12-17 18:26:36
Gravatar image Andrew,

That's ("_blank" to "_self";) what I did with the updated version you can find in the comments. I don't know why it's "invisible" now. Do you have it working correct? If so, please contact me and send me the correct file and I can post it here again.

Like I said before, there's no need for a donation. Reactions like you give are enough "donation" for me! Just keep on checking on this website or subribe to the feed for new articles will do it for me :wink: .

Have a nice day,
Greetings,
Marco
Andrew - @ Marco - open same window   | 64.81.169.xxx | 2007-12-17 20:03:00
Gravatar image Hi Marco,

I downloaded the source.zip again, and checked the large.fla again...frame 44, Action Layer still says "_blank". Not sure which file you are referring to...?

I can change the Action Script in the large.fla for you, send it over to you, and then you could republish it via your version of Flash Pro. I think that would fix the problem, since it seems to be an issue when the large.swf is republished in a newer version of Flash Pro...thoughts?

My email: pagepeel@experiencefluxx.com

You're sure about no donations?

Thanks!
Andrew
Marco - re:   | 62.194.187.xxx | 2007-12-17 21:43:56
Gravatar image No, I was referring to this large.swf that I placed in the comments above.

That one works with the "_self" thingie, but for unknown reason the peel is transparent. If you can make it working (without transparent peel), that would be enough donation for me :lol: .

Yeah, I'm sure about the donation, I don't even have a PayPal account (yet :wink: ).

I've send you a mail.

Greetings,
Marco
Blinky - Reflection   | 193.77.47.xxx | 2007-12-27 01:44:57
Gravatar image Can someone help me remove the Reflection? Instead of that I just want white (or some other color) page - how can I do that in flash?
Blinky - Reflection   | 86.61.1.xxx | 2007-12-27 17:39:03
Gravatar image Or is that in peel.js to change?
Ron - Might be usefull to know   | 80.35.39.xxx | 2008-01-04 13:52:24
Gravatar image First of all great script :D

If you have the script on www.example1.com and wish to include it on www.example2.com then do this:

1* open peel.js and change peel/small.swf to www.exaple1.com/peel/small.swf (change 4)
2* upload a crossdomain.xml to your peel folder.
3* Call the java and your Done :D

crossdomain.xml example
Code:




Shawn - Reflection in source   | 64.199.79.xxx | 2008-01-09 23:34:34
Gravatar image First off, thank you very much for the script and flash source, this is an excellent resource.

Has anyone found a fix for the problem TS reports with lost reflection?

I just tried this in Flash 8 and get the same result.

When I open large.fla in Flash 8 and Test Movie, the peel reflection is lost. Get the same results in CS3. At first I thought it was a CS3 issue, but I get the same results in Flash 8.

Marco, what version of Flash are you using to build/publish the original?
Marco - Flash 8   | 62.194.187.xxx | 2008-01-10 08:53:10