Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-21-2009, 04:15 PM   PM User | #1
jonni
New Coder

 
Join Date: Sep 2009
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
jonni is an unknown quantity at this point
Modification to slightly repurpose JW Box

I'm testing a great piece of code and have it doing ALMOST everything I want but I'd like to change it very slightly. Try as I might I just can't unravel the mysteries and get it to work. Currently it lets a user click on an image and does a lightbox type display of some video content. When the video completes it automatically closes the lightbox and returns to the original display by hiding the content.

I would like it to display the lightbox and it's content when the page loads instead of the user having to click an image to display the lightbox and it's content.

This is a link to my TEST PAGE It displays a video player and plays approx 20 seconds each from several music videos and then closes itself up when the test file (an xml playlist) is exhausted. I hope someone here can look at this jquery source and my html source and tell me how I might achieve what I want.

This is the jquery source.
Code:
jQuery.fn.center = function () {
	this.css("position","fixed");
	this.css("top", ( $(window).height() - this.outerHeight() ) / 2 + "px");
	this.css("left", ( $(window).width() - this.outerWidth() ) / 2 + "px");
    return this;
}

jQuery.jwbox = {
	lightbox	:	null,
	player	: null,
	toggle	: function(context) {
		if (!$.jwbox.lightbox) {
				$.jwbox.lightbox = $(".jwbox_hidden", context);
				$.jwbox.center();
				$("#jwbox_background").fadeIn("fast");
				$.jwbox.lightbox.css("display","block")
				$.jwbox.center();
				$("#jwbox_background").fadeTo(0, 0.8);
				$("object", context).each(function(){
					$.jwbox.player = document.getElementById(this.id);
				});
		} else if ((context.className == 'jwbox_content')) {
		} else {
			try {
				$.jwbox.player.sendEvent("STOP");
				$.jwbox.player = null;
			} catch (err) {
			}
			$.jwbox.lightbox.css("display","none");
			$.jwbox.lightbox = null;
			$("#jwbox_background").fadeOut("fast");
		}
	},
	center	: function() {
		if ($.jwbox.lightbox) {
			$.jwbox.lightbox.center();
		}
	}
}

$(document).keyup(function(event){
    if (event.keyCode == 27 && $.jwbox.lightbox) {
		$.jwbox.toggle($("#jwbox_background"));
    }
});

$(document).ready(function () {
	$("body").append('<div id="jwbox_background">&nbsp;</div>');
	$(".jwbox").click(function () {$.jwbox.toggle(this); return false;});
	$("#jwbox_background").click(function () {$.jwbox.toggle(this); return false;});
	$(".jwbox_content").click(function () {$.jwbox.toggle(this); return false;});
	$(window).resize(function() {$.jwbox.center();});
});
Any advice will sure be appreciated.

Last edited by jonni; 11-21-2009 at 04:20 PM..
jonni is offline   Reply With Quote
Old 11-21-2009, 09:59 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
Don't call the whatever-it-is with the click event, just call it. That didn't work?
__________________
Fumigator is offline   Reply With Quote
Old 11-22-2009, 12:37 AM   PM User | #3
jonni
New Coder

 
Join Date: Sep 2009
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
jonni is an unknown quantity at this point
Too new to understand

Thank you for attempt to help. Unfortunately I don't understand the code well enough to know "what-ever-it-is" not how to call it. Or perhaps even wher to call it from.
jonni is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:16 PM.


Advertisement
Log in to turn off these ads.