|
FAQ
Is Slimbox able to display Flash content (like videos), iFrames or other content?No, Slimbox has been designed from the ground up to display images only, to be simple and to have the smallest code. However, some people have created Slimbox derivatives that implement these features. Because it's open source, you are free to modify the code to fit your needs, as long as you respect the terms of the licence and keep the credits. Can Slimbox automatically resize my images when they are too large to be contained in the browser window?Slimbox should not be used to display very large images. The general rule is that the images that you want to show with Slimbox must never exceed the width of your website template. You need to create reduced-size versions of your large images before displaying them with Slimbox. Why? First, very large images are better handled by the browser itself when opened in a dedicated window: usually in this case the browser will show the image progressively while it's loading and will automatically resize it to fit the browser window which is exactly what you want. Second, Slimbox preloads images and only shows them when they are completely loaded. For very large images, this takes some time and this is bad for the user experience. Then, when the image is eventually loaded and shown, next and previous images of the gallery will start to preload too, even if the user does not intend to see them, thus it will use a lot of bandwidth on your website. Third, dynamically resized images look pixellated in most browsers. And finally, dynamic image resizing would make the Slimbox code very complex and there is actually no way to make it work flawlessly. Here's a quick technical explanation (you may skip it to avoid headaches):
Slimbox display is incorrect on my website (sometimes only in a particular browser). What's wrong?Most of the time, this is an issue with the CSS of your web page. Check that your CSS rules are valid and do not override Slimbox' CSS rules. In particular, check that there is no margin applied to your <body> and <html> tags, and that you don't override the default appearance of all <div> tags. If your CSS is correct, you may have invalid or malformed HTML code. Don't expect Slimbox to work well in web pages containing two <body> elements, for example. In particular, Internet Explorer tends to be less tolerant regarding invalid CSS or HTML. Can I change the Slimbox images, colors, fonts, margins, border sizes?Yes of course, you just need to edit the values in the CSS file. Slimbox uses CSS instead of javascript whenever possible. How can I use HTML for the image descriptions?You can use HTML for the image descriptions without problems. But if you insert HTML markup inside a "title" attribute in your HTML page, you need to replace the following characters:
You don't need to do this if you set the HTML markup for the description programmatically using Javascript (see jQuery API or MooTools API). You can also write a custom linkMapper function which will grab the whole HTML content of a paragraph in the page for example and use it as a description instead of fetching it from the "title" attribute. This way, you don't need to transform the HTML markup either. The loading of one of my images in Slimbox takes forever. What's wrong?This happens when the URL of the image is incorrect or unavailable. Check that the URL is correct and that the server hosting the image is online. Slimbox does not display images containing parenthesis in their URL. What's wrong?Parenthesis are invalid characters for URLs. You must use their URL-encoded equivalent instead. Just replace ( with %28 and ) with %29. You must also replace spaces with %20 or +. Other invalid characters include commas, square brackets, exclamation marks, question marks, semicolons, quotes. If you are using PHP, the urlencode() function will automatically replace all invalid characters with their URL-encoded equivalent. Is there a way for the visitors of my website to save the images displayed by Slimbox?When you right-click on an image displayed in Slimbox, there is no option to save it because it's actually a <div> tag, not an <img> tag. However if Slimbox is opened by clicking on an image link, your visitors can right-click on that link and choose "save target as..." to save the image. If it's not enough for you and you want the visitors to be able to save the image from inside Slimbox, you can modify the "autoload code block" so that a link to the image is added automatically after the image caption. This is achieved by defining a linkMapper function (see the jQuery API or MooTools API documentation for more information). The autoload code block is located by default in slimbox.js but may be moved inside the HTML page if you want. Here's the new code: jQuery version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(function($) {
$("a[rel^='lightbox']").slimbox({/* Put custom options here */}, function(el) {
return [el.href, el.title + '<br /><a href="' + el.href + '">Download this image</a>'];
}, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
});mootools version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
Slimbox.scanPage = function() {
$$($$("a").filter(function(el) {
return el.rel && el.rel.test(/^lightbox/i);
})).slimbox({/* Put custom options here */}, function(el) {
return [el.href, el.title + '<br /><a href="' + el.href + '">Download this image</a>'];
}, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
};
window.addEvent("domready", Slimbox.scanPage); I'm using sIFR and the sIFR text appears over Slimbox instead of being hidden. How can I fix that?When calling sIFR.replaceElement(), you must set the "sWmode" parameter to "transparent". Please read the sIFR documentation for more information about how to do this. Is it possible to open Slimbox in the parent frame when clicking on a link inside an iframe?(i)frames should be avoided as often as possible. It's generally a bad idea to use them: they are deprecated by the W3C, they make things more complex and slow down page loading. Note that you can mimic the appearance of an iFrame with the scrollbars using a div block having the CSS property "overflow: auto;" and a fixed width and height. Also, you can change its content using ajax calls. However, if you really, really want iFrames, there are two ways to do this by modifying the "autoload code block" of the parent frame. By default, this code is located in slimbox.js but you can move it inside the HTML page if you want to. Each way has its own drawbacks and will not work as well as if you were not using iframes. In both cases, you need to setup the full slimbox in the parent frame (jQuery/mootools + slimbox + css) and you only need to include jQuery/mootools in the child frame (no slimbox or css). If you don't add jQuery/mootools in the child frame, an error will occur when clicking on a slimbox-enabled link. Solution 1jQuery version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(function($) {
function scanFrame() {
$("a[rel^='lightbox']", this.document).slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
}
scanFrame.apply(window);
$.each(window.frames, function() {
this.onload = scanFrame;
scanFrame.apply(this);
});
});mootools version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
Slimbox.scanPage = function() {
function scanFrame() {
$$($$(this.document.links).filter(function(el) {
return el.rel && el.rel.test(/^lightbox/i);
})).slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
}
scanFrame.apply(window);
Array.forEach(window.frames, function(frame) {
frame.onload = scanFrame;
scanFrame.apply(frame);
});
};
window.addEvent("domready", Slimbox.scanPage);Drawbacks:
Solution 2jQuery version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
jQuery(window).load(function() {
var $ = jQuery, links = [];
$.each($.merge([window], window.frames), function() {
$.merge(links, $("a[rel^='lightbox']", this.document));
});
$(links).slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
});mootools version // AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
Slimbox.scanPage = function() {
var links = [];
[window].extend(window.frames).forEach(function(frame) {
links.extend(frame.document.links);
});
$$($$(links).filter(function(el) {
return el.rel && el.rel.test(/^lightbox/i);
})).slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
};
window.addEvent("load", Slimbox.scanPage);Drawbacks:
Which minification tool are you using for the main Slimbox code?The best one: YUI Compressor by Julien Lecomte. The code was also written in a way that allows it to be efficiently minified with this tool. |
How opening slimbox from xml
I want to restrict the height of the image in the slimbox. Is it possible? If yes, how?
How do I do multiple galleries? I don't quite understand the included tutorial.
Hello,
very nice script! I have the problem that I like to open the same gallery from different links. Every link makes a new "first picture", so if i link 3 times to "1.jpg", the gallery will be "1.jpg 1.jpg 1.jpg 2.jpg 3.jpg ...".
Is there a way to fix this?
I cant make the iframe solution work. The page im modifying has already an Iframe in place and to change it to overflow would take too much time. The slimbox loads only inside the iframe and not in the parent window. Any help?
Great script. Is there any plans to have error handling for image URL's that do not exist? I implemented it myself but it's buggy.
Hi,
I'm trying to let the script run with images and link created dinamically after the page has been loaded. More, page loaded, then user choose an option on the combo, page content is refreshed loading values from an xml file and I need to add or remove many links from the xml file as well.
Unfortunately your script, as well as other lightboxs I tested, works on html code written and parsed during the load event. I tried to call the scanPage event again without success. How can I solve?
Thanks
Is it possible to move the entire window down about 100 pixels? If so, how?
une réponse à tester pour les liens dynamiques via ajax: http://www.tranquille-informatique.fr/informatique/slimbox/utiliser-slimbox-apres-une-mise-a-jour-de-page-suite-a-une-requete-ajax.html
good luck
I was wondering if there was any way to make the "Next" and "Previous" tabs stay up rather than appear as a mouseover effect. I know this was possible with the original lightbox but did not find any options or parameters that would allow for it here.
@jellatin:
This can be done in the CSS.
Just look for #lbPrevLink and #lbPrevLink:hover. Copy the background declaration from the latter to the first. Then you do the same with #lbNextLink and #lbNextLink:hover. Now you are done. You can additionaly delete or comment out #lbPrevLink:hover and #lbNextLink:hover.
Summarized you should have something similar to this:
#lbPrevLink { left: 0; background: transparent url(prevlabel.gif) no-repeat left bottom; } #lbNextLink { right: 0; background: transparent url(nextlabel.gif) no-repeat right bottom; }Hope I could help Ole
How can you show Next and Previous as text links in lbBottom?
Is it possible to add a print button that prints the picture and caption only?
The keyboard navigation will not work when you click on a slimbox-enabled link inside an iframe, because the iframe will capture the keyboard events instead of the main frame. <== How to fix this erro?
oh. I have fixed this erro. Happy!
I have used Slimbox since the Slimbox 1.0 days with mootools. Now it is even better using the JQuery library. I just switched to this newer Slimbox 2 version this week. I was already using the JQuery library for my menu, so I saved an extra javascript by switching. Also, the images seem to render more quickly now. The added options are great. I switched on the image loop feature for example. I do wish the images auto-resized to fit a browser window, such as in a netbook, from which I am typing this. However, I realize that would add to the complexity and size of the script, which is only 4 kb minified.
Is there a way to force slimbox from initiating for certain images, such as adding something like slimbox='no' to the HTML?
Is it possible to use this script to open a YouTube? video in the lightbox? If so, how would I go about doing it? :)
Chris
How do you place an outside link in the caption of the image? i.e. the mutt (want mutt to link to www.google.com)
Is there an optimal file size and is there a file size limitation. For example would 200K be too large? Take care, Travis
How can i install slimbox on blogger?
like escargotconcepts, question on Sep 16, 2009
Is there a way to add a link inside the caption area to a URL, or say a pdf file? this would be pretty rad and help out a ton. trying to figure it out.
@ escargotconcepts
after some google searching I found an answer to putting a link in the caption area and thought I would just post it for others to use it. I tried it and it works. http://www.onedigitallife.com/2007/01/24/lightbox-slimbox-and-caption-links/
Thank you so much for this work. It is very strong and well-liked.
I am trying to make the opening transition faster though. I don't want to watch the box stretch open and across before my image is displayed. I just want to click and have the slimbox open showing my picture. No animated transition on open.
I have tried lots of things in the code and the script... what I think SHOULD work has no effect.
Anyone tackle this issue?
Thanks.
I've used your script to modify the "autoload code block" of the parent frame to open Slimbox in the parent frame. http://www.st-moritz-taucha.de/verein/index1.html It's a good result with IE, Firefox doesn't work. I can't find the cause. Can you help?
@escargotconcepts: You can actually insert HTML in the "title" attribute but you need to escape special chars like < or > or " by replacing them with HTML entities. When adding Adding HTML to the caption using javascript code, you don't need to do that.
@Carol.Wood7822: like you do for any other website. Edit your blogger template.
@contactklucas: Use a transition duration of 0 or 1 and no effect will be displayed. This is written in the documentation by the way (not this page but the docs describing the options).
for Everybody: Don't post you questions on this page, use the forum. http://groups.google.com/group/slimbox-support
I am using your jquery code to save the image. I'd like to add a link to download the High Quality image too, just adding the "hq" of the pic name (URL) to the "el.href". How can i get this name change? Thanks.
I don't know if this is possible, but can you have a set but only have a single image displayed, like an album cover, but once you click, be able to click through the set? Example: I want 50 images in my set, however, I don't want all 50 images shown on the page, can I just show the first image for activating slimbox, then click through the rest of the 49?
Hello. is there any way to put the close butoon at top of the frame instead of the bottom?
ditto precisely what harnatc asked. I've been looking for something that can do that, too.
I have modified the script to allow horizontal scrolling (for large images). Download that version here
Is there a way to change the size and position of the box that says "Loading" when the thumbnails are loading on the page? It's the box that displays the text from this line in the pwi1.0.js file... pwi_labels["loading"] = "LOADING IMAGES...";
Chris, Install "Like you would on any website". What an idiotic response. Not enough fibre in your diet i suppose. Have you considered the possibility that this person does not have knowledge on how to install it at all? I teach people quite a few things, and try to put myself in their position. Try a bit of that, than perhaps, people might not be inclined to say that programmers are good at what they do but quite moronic at logic-application when applied elsewhere.
ed
@to.inquisitor, lol. I couldn't agree more.
Is it possible to create a set by only displaying one image, then letting the user navigate through the whole set with the arrow keys or next and prev links? That is, the rest of the photos don't show on the website except for the very first one?
Hello all :) I am looking for a way to close the image just by clicking on it in addition to click outside the image. Is it possible ? Somebody know which code I should use for that ?
Thanks in advance
Why is there in the zipfile 2 times the file: slimbox2.js? In which one do I have to make adjustments?
How can I track individual image views using i.e. Google Analytics ?
I need to call a function when slimbox open (click event on image thumbs) and another function when the user close it. How i can do this?
I'm currently using slimbox on a website but i have a bug. The slimbox doesn't fit to the image's size. Example on this page : http://www.savoie-mont-blanc.com/nos-suggestions/bouger/activites-velo/les-defis-du-cyclogrimpeurs-1572-1.html. Bug under Chrome 7.0.517.44 and Mac OS 10.6.5 but also under Chrome 7.0.517.44 and Win XP. Anyone have already this malfunction ? ( Slimbox 1.71a with mootools 1.2.4 )
$$($$("a").filter(function (el) {return el.rel && el.rel.test(/^lightbox/i);})).slimbox is not a function
I am getting this error in joomla how can i handle it.
Thanks
How to open slim box on load of page???????help me
Add the following code (based on your framework) into your pages’s <head> tags.
Mootools: <script type="text/javascript"> window.addEvent(“domready”, function() {
}); </script>jQuery: jQuery(function($) {
});I've got a tiny markup problem (using todays downloaded version).
see image: http://www.plaatjesupload.nl/bekijken/3473520.html
how to fix this?
Slimbox on iPad only shades half the screen while lightbox does the whole screen.
@andrea.m
I resolved a similar problem by declaring "<script type=\"text/javascript\" src=\"js/slimbox2.js\"></script>" again in the dynamic pictures that were loaded. There is nothing similar to initLightbox() (like lightbox has) that I found for slimbox.
Is it possible to download the larger images? Clicking the right side of the mouse doesn't appear "save image as ..." with IE or Chrome ; this is possible only with the miniature (small image). A. Iacono
How can i install slimbox in gallery 2 and replace with lightbox to popup thumbnails
How can I print an image inside the slimbox?
Hi, I installed slimbox 2 on a website and it worked fine. (www.estherberesfordmuravyeva.com/art_commissions_murals). I have now installed it on my own site, doing exactly the same things, and I've checked the script again and again, and it just doesn't want to work this time... any clues??
My site is www.jessicaibbotson.com/drawings
Please help...!
Hi, is there a way to show the close box at the top instead of at bottom? Thanks
Lovely code. BUT it won't allow me to make the original graphic that links to the slimbox as a rollover. I submit the rollover coding against the graphic in a variety of different ways, and I'm getting no luck. I want the viewer to know that these links are more than just a small graphic on the page, I want them to be rollovers therefore more noticeable, SO, how do I do this? Thanks, Cat