iWeb Tip #15 – Lytebox in iWeb

80
24231

Lytebox in iWebSo I know I’ve been on this kick of the little pop-up effect in iWeb and the FancyZoom and Highslide effects I thought we’re enough, but then I came across this effect here and found it to be pretty easy to implement (easier than Highslide), I thought I’d post this one as well.  So here we go:

View Demo »

Step 1) Download Lytebox by clicking here »

Step 2) Add images to your iWeb page and make them a hyperlink (as a file) to itself (the same image).

Step 3) Publish your iWebsite to a folder, iDisk, or server.

Step 4) Add the “lytebox” folder you downloaded in step one to the site folder (not the page folder)

Step 5) Open html page (the one with the images linked to itself we did in step 2) in an HTML editor.  I like to use Coda (by Panic Software), but you could use TextEdit (if you check on ignore rich text commands in HTML files checkbox in the preferences of TextEdit), or Espresso, TextWrangler, etc, etc, there are a bunch.  Just something that you can edit HTML in.

Step 6) Right above the </head> tag in the HTML, paste these lines of code.

<script type="text/javascript" language="javascript" src="lytebox/lytebox.js"></script>
<link rel="stylesheet" href="lytebox/lytebox.css" type="text/css" media="screen" />

Step 7) Then find where your image links are and add a rel=”lytebox” in between the link and the tittle tag. For example, here is what your looking for in the HTML:

<a href="mypage_files/my_image.jpg"  title="Image Description">

Put the rel=”lytebox” inbetween the image link and the title tag so it looks like this:

<a href="images/image-1.jpg" rel="lytebox" title="Image Description">

Step 8 ) Save and that’s it your done.  You’ll have a cool image popup effect, similar to highslide or fancyzoom, but slightly different.

Options: (If you dare :-))

Grouped Images:

If you want to have the images scroll through with a cool next and previous button to the lytebox, then instead of adding rel=”lytebox” in between the image link and title tag, add rel=”lytebox[group1]”to each image link and there will be a neat navigation to cycle through the images.  Here’s an example of what the code would look like:

<a href=”images/image-1.jpg” rel=”lytebox[group1]” title=”Image Description”>

You could have multiple sets on one page too if you change the group1 to something like group2 for all the ones you want in a seperate group and so forth.  Click the example button above for reference.

Keep in mind that the images will scroll through in the order they were dropped onto the page (not necessarily the order top to bottom that you have them in on the page.  So be sure to add images to the page in the order you want them to show up in the lytebox effect.

Lytebox Slideshow:

You can also have a little slideshow effect in the lytebox popup by using rel=”lyteshow[group1]” instead of the rel=”lytebox” (single images) or rel=”lytebox[group1]” (multiple images).  So your link code would look like this:

<a href="images/image-1.jpg" rel="lyteshow[group1]" title="Image Description">

iFrame Content in Lytebox:

If instead you want a webpage in the lytebox effect instead of an image, then simply add a link to an external page (it could be one of your own pages).  Find the code in the html where your link is and add rel=”lyteframe” instead of the others above.

Note: When using this effect it only works with highlighted text links (not textbox links) and image links.  It does not work very well with iWeb shapes for links.  For those, use the Highslide effect.

When applying the Lytebox effect it will take a default width and height of 400px and scrolling is set to auto.  If you want to control how big the frame is for your iFrame then add this code in your title tag

rev="width: 400px; height: 300px; scrolling: no;"

Replace the items in the brighter red to the size you want and your set.  Here is an example of the full link code as an example:

<a href="https://www.google.com" rel="lyteframe" title="Search Google" rev="width: 400px; height: 300px; scrolling: no;">Google Search</a>

You could even group pages together like we did with the images above by using this “rel” tag instead: rel=”lyteframe[group1]

Another note on doing this if your using iFrames on your iWebpage: If you plan to use Lytebox in an iFrame environment, then you need to include lytebox.css in the parent document, while including lytebox.js in the iFrame document.  They are both found in the lytebox folder.

Browser Compatability:

This effect was built with browser compatability in mind, so it’s safe to say it works on most all browsers.  The following browsers have been tested with this script:

IE 5.01 SP2 – The fade effect does not work, but the background is darkened (completely).

IE 5.5 SP2 – No known issues.

IE 7.0 – No known issues.

Opera 9.23 – No known issues.

Firefox 1.5+ – No known issues, of course.

Safari 2.0+ – No known issues, of course.

End Notes:

Well that’s it folks.  Hopefully it’s not to crazy for you.  Like I’ve said in other posts.  I usually don’t like having to get into the HTML code after publish if possible, but sometimes to get a cool effect you just gotta.  So don’t work yourself up to much if you don’t get it the first time.  A simple republish in iWeb will let you start over and try again (though I recommend publishing from the File menu with the publish entire site option to get a clean full publish).

80 comments

  1. Andrew 16 February, 2010 at 15:35 Reply

    What is the difference between using the term “a href” and “area href”? When I try to edit my code I have area href and when I add “rel=”lytebox”” nothing works, but if I change it to “a href” I get the effect but not on my buttons, they are like pushed over to the next one. Also one of my images is rather large when I do get the light box effect working by clicking the different button, it is really small like when it first loads before you can zoom into it, how can I fix that?

  2. Andrew 16 February, 2010 at 19:19 Reply

    I fixed the issue I was having, I was not using an image but creating a button. The issue I am having is on my larger images that have a scroll bar on them, when viewed on firefox you have to click on the image for it to fit the box, is there a way to fix this?

    • iWebUnlimited 21 February, 2010 at 20:44 Reply

      I’d suggest sizing your images to have a width of about 640px or so to be sure to accommodate all browser and all screen sizes.

  3. Joel 20 February, 2010 at 21:05 Reply

    Hello! I followed all your directions and everything went fine, except one thing.
    Everything worked until I published something else, it just stopped. Can You Please Help Me!

  4. iWebUnlimited 20 February, 2010 at 23:50 Reply

    Andrew, I’d suggest sizing your images to have a width of about 640px or so to be sure to accommodate all browser and all screen sizes.

  5. iWebUnlimited 20 February, 2010 at 23:52 Reply

    Joel, there could be many many problems. From the info you supplied there is no way to troubleshoot the issue. This may be something for the forums, where you can create a longer post and we can create a thread to try and help you with your problem.

  6. Joel 21 February, 2010 at 01:00 Reply

    Iwebunlimited, Is there a way (or a program) that will keep the html code so that when we re-publlish the entire site, we don’t have to start all over? I suspect that only “publishing modifications” on iWeb will keep them but I’m not certain.
    Also, maybe keeping a copy of the “pagename”.html in its final version with lytebox lines and replacing the same file on the server after having re-published our site could do the trick.
    Any ideas?

    • iWebUnlimited 24 February, 2010 at 10:08 Reply

      Joel, unfortunately there isn’t. One thing you can do is to make a new site in iWeb that has your Lytebox publishing and the rest of your site separate. Then just link to the different pages appropriately in your navigation (see my tip on navigation in iWeb). That way when you publish your regular site you won’t have to redo the Lytebox side of the site and it can remain separate. Hope that helps.

      • Jaza 22 July, 2010 at 21:10 Reply

        Hi iWebUnlimited,

        Do you think you could publish a video on how this is done? I’d really like to have a workflow clear on how I can save the changes made to the html code separately so in case I have to republish with iweb I dont have to start all over.

        Great site! Thanks for all the tips!

      • Kirk 6 August, 2010 at 09:14 Reply

        Could you post a video or text tip on how to do this? Because I don’t quite understand. I don’t want to have to re-type the code for every picture everytime. Thanks!

        • iWebUnlimited 14 August, 2010 at 23:23 Reply

          Kirk, take a look at the Highslide Tutorial that I have. It’s done the exact same way as the lightbox.

  7. Tasha 21 February, 2010 at 08:21 Reply

    I follow all the steps (publish to folder on desktop) and everything works great. Then I ftp the files, as I usually do, using cyberduck and the script doesn’t function correctly/at all. I spent a lot of time trying different things and now I’m fed up.

    Please advise.

    Many thanks

    • iWebUnlimited 24 February, 2010 at 10:05 Reply

      Tasha send the URL of the online page. It’s hard to help when there’s nothing to look at. This might be a topic for the forum. This is more for comments. But 3 things to check. 1) You have the code in the tags correctly 2) You have the code in your links rel=lytebox correctly 3) You have the file folder along side your html file on your server. If you have double checked all these things already and they are correct and it’s still not working, post a link on the forum and we’ll see if we can help you out.

  8. adam 28 February, 2010 at 20:33 Reply

    Is there a way to use lytebox with quicktime? For example, I’d like to show a static jpg on my page and then have a movie play when the image is clicked (tagged lytebox).

    Thanks –

    • iWebUnlimited 14 August, 2010 at 23:28 Reply

      Adam, try using Shadowbox or Highslide instead. It has the same effect as this, but has a bit more features such as using the effect with video.

  9. And 3 March, 2010 at 06:20 Reply

    Hey iWebUnlimited!!!
    I’m an Italian boy…so, say thank you to Google ;-P
    I’ve pubblished my lytebox-gallery page, but I’ve some problems with IE (version 6, 7 and 8)…
    In Safari and Firefox everything works perfectly, but when I try to open my lytebox-gallery with IE, it starts to go slow (extremely slow)…
    I think that the issue is connected to my images’ resolution…

    So: do you know the best resolution/dimension that I have to use?!?!

    Thank you man!!!

  10. Josh 4 March, 2010 at 15:50 Reply

    I really like this application and got it to work…at first. My problem is that I am masking my images. I have artwork to show and I am interested in just showing a thumbnail section of it, then when someone clicks on it I am hoping that lytebox will then pop them up as the full images I have them linked to. So far, I am not able to make this happen. Perhaps I need to add additional code or place rel=”lyteshow[group1]” in a different spot? Any tips?

  11. de_autojohn 6 March, 2010 at 10:42 Reply

    Hi ijason,

    how do I include the lytebox.css in the parent document and the lytebox.js in the iframe document?

    Just paste the codes in the head?

    Thx !

  12. Alain 12 March, 2010 at 04:54 Reply

    Hello! I have followed the instruction, lytebox works good when i make a test with coda, but when I published my site with FTP not work, It open the photo in another page in large format..

    Can somebody help me? Thank You very much!

  13. R 17 April, 2010 at 16:25 Reply

    if you can show this step by video will be much much helpful, coz i really don’t know how to do it, Many Thanks

  14. Chris 30 May, 2010 at 13:01 Reply

    HELP! I have followed these directions to the letter, (copy and pasting just to be sure), and none of my links are going to lytebox. When I click on an image, it just opens the image that I have on my iDisk. I am using OSX 10.6.3, iWeb ’09 and Coda for HTML editing. Any help would be greatly appreciated. I am also setting these images up as a group, nit individual photos.

    Thanks for the Help

  15. Michel 8 June, 2010 at 15:50 Reply

    Hi. Lytebox works great for me. I would like to change the dimensions of the zoom. The size of my image is 309 X 200, but I would like them to show about the double, once clicked through lytebox. Love your site, thanx for everything!

    • Michel 9 June, 2010 at 17:40 Reply

      Found the answer. The second format (the end of the zoom) depends of the size of the original image you do the hyperlink to itself. Solved!

  16. Chris S 16 June, 2010 at 20:06 Reply

    I am having the same problem as the other Chris above.

    I’m pretty sure I have followed the instructions perfectly; however, once everything is done and uploaded, and I click on an image, it just opens a new page with the image. No lytebox fanciness. : (

    Is there something I’m missing?

    Thanks.

  17. george 27 July, 2010 at 16:06 Reply

    OK, this is NOT working. Like everyone else, it works on my computer, but when I try the online address after I’ve uploaded them, it just opens the pics in another window..

    getting ANOYING!!!

    someone have an answer?

  18. Justin 17 August, 2010 at 12:15 Reply

    Hey! Great tutorials and tips i really enjoy them. I am using lytebox fairly well although im running into one issue, i have inserted the code and all that, it works. Although i have a quicktime video that is running on my page aswell all the time and when the lytebox gets activated, when i click on it and the background goes gray and the image pops up the video does not go gray it is in the very front infront of my lyteboxed image. Do you konw a way around this? thanks,

    justin

    • Jeremy 19 August, 2010 at 15:51 Reply

      Just did the Shadowbox code in the same way, and everything works now. Clearly, I am doing it right… but I prefer Lytebox… any suggestions on why it was not working? It is the same type of coding… I am confused.

      Help me use lytebox if you can :)

      Jeremy

  19. Nico 5 November, 2010 at 08:49 Reply

    Amazing website ! It has helped me a great deal !

    Is it possible to launch Lytebox group photos from text or buttons vs The actual photo. When I try it somehow creates duplicates and disorders everything…

    Thanks

  20. Max 8 November, 2010 at 14:57 Reply

    hey, so i love the lytebox effect for photos and videos. but… what i really want is for it to look like the lytebox effect apple uses throughout their site.

    the image associated with this article, the one at the top of this page, is what i am looking for. the white border with a circular “x” to close the window at the top left. i realize this is all in the css, etc., but does anyone have any quick solutions for me.

    thanks in advance! i love forums like these!

    max

  21. JY 17 November, 2010 at 10:55 Reply

    Does anyone know how to get lytebox over iframe?
    I am using iframe for my flash navigation bar, and the lytebox for showing images just always appears behind the iframe.

    Thanks in advance.

Leave a reply

Facebook
Twitter
YouTube