| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
LightBoxLite - light weight version of Light Box concept
Those familiar with Light Box probably know most of the scripts
involve complicated prototypes and thousands of lines of code. I tried one of those and got burned. It was too heavy, and ruined the very structure of the document. Frustrated, I simply created my own version of Light Box. Here is the result - below full source code and attached the two required files. Good luck, happy programming and let me know if you have any questions or comments. ![]() Code:
--LightBoxLite.html
<html>
<head>
<title>LightBoxLite Example Page</title>
<script type="text/javascript" src="LightBoxLite.js"></script>
<script type="text/javascript">
LightBoxLite.SetWindowBackground("#303030");
LightBoxLite.SetLightOptions(350, 260, "white");
LightBoxLite.SetClosingElement("btnCloseBox");
function OpenLightBox() {
LightBoxLite.ShowInnerElement( document.getElementById("LightBoxSampleDiv") );
}
function SampleFunction() {
alert("as you see, you can have anything you want inside the Light Box. including buttons.");
}
</script>
</head>
<body>
Hello.<br />This is ordinary page.<br /><br />
It can contain anything you want.<br /><br /><br />
Click <a href="about:blank" onclick="OpenLightBox(); return false;">this link</a> to see how the Light Box is working.<br /><br /><br />
The LightBox effect is nice, hope you find it useful!<br /><br /><br />
<div id="LightBoxSampleDiv" style="display: none;">
You won't see me at first. Put anything you like in here.<br /><br /><br />
<button type="button" onclick="SampleFunction();">Just Some Button</button><br /><br /><br />
<button type="button" id="btnCloseBox" onclick="alert('you clicked the Close button');">Close</button>
<button type="button" onclick="LightBoxLite.Close();">Cancel</button>
</div>
</body>
</html>
**due to technical reasons, I can't post full JS code here, please download the zip file to see and use the Javascript code. Last edited by Shadow Wizard : September 25th, 2007 at 09:25 AM. |
|
#2
|
|||
|
|||
|
Hey Shadow,
Error: Line 37 Expected: ')' ![]()
__________________
jmurrayhead Did I help you out? Make me popular by clicking the icon!New Members:Proper way to post a question Powered by ASP.Net |
|
#3
|
||||
|
||||
|
sorry JMH but I've just downloaded the zip to clean location,
unzipped and tested and it works flawlessly in both IE and Firefox. what exactly have you done that caused this error? also, try using FireFox, it has Error Console that can show the real code causing error, not just cryptic line number. apart of all that, line 37 is this: Code:
LightBoxLite.ShowInnerElement(LightBoxLite._innerE lement); honestly, it can't generate such error so it must be something else. ![]() edit: oh my.. I see what happened - you copied the code, and the forum added blank spaces to break long words. I'm going to remove the JS code now from the post, use the zip file only. |
|
#4
|
||||
|
||||
|
any chance you could animate the opening of the window?
Shem
__________________
Everyone has a photographic memory. Some don't have film. I am a nobody, nobody is perfect, therefore I am perfect.
|
|
#5
|
||||
|
||||
|
Quote:
no point in rebuilding the same thing. ![]() want something fancy, cool and heavy? use what you have now. prefer something light and simple? use the code above - the choice is all yours. ![]() by the way Shemzilla, thanks - you showed me the original code, and I've decided to show this to my bosses and they're really happy now.. ![]() |
|
#6
|
||||
|
||||
|
Quote:
glad i could be of service ![]() Shemzilla |
|
#7
|
|||
|
|||
|
Quote:
Indeed, I got it working eventually. Sorry took so long to post back what happened, been really busy ![]() BTW, very nice script ![]() |
|
#8
|
||||
|
||||
|
Quote:
cross browser transparency - couldn't have done this without it. can't remember who it was though.. ![]() |
|
#9
|
|||
|
|||
|
I'd just like to thank you for such great code. I'll definitely get some great use out of this script. Thanks!
|
|
#10
|
||||
|
||||
|
Hi Shadow
A quick question, can you modify this to open pages as well as inline content? Shem |
|
#11
|
|
|
|