View Full Version : SqueezeBox with Print Button

12-17-2011, 03:27 AM
I'm working with the squeezebox modal.js implemented with Joomla! for my images in some extra fields. I'm trying to add a print button functionality in order to print the image within the lightbox.

Adding the button was fairly easy, I simply copied and pasted

this.closeBtn=(new Element("a",{id:"sbox-btn-close",href:"#"})).inject(this.win);

and made

this.printBtn=(new Element("a",{id:"sbox-btn-print",href:"#"})).inject(this.win);

I then made my print button png, went into the modal.css, added this:

#sbox-btn-print {
position: absolute;
width: 30px;
height: 30px;
right: 10px;
top: -15px;
background: url(../images/modal/print_btn.png) no-repeat center;
border: none;

And boom, print button, however making it work right is certainly not coming along as easy. I tried changing the href to
but that just prints the contents of the browser, not the image in the box, no bueno. I then tried pushing the button functionality into a separate javascript function, but couldn't even get that far. I'm sure if I tweak it enough I can make it work, but I'm not all that great at programming within javascript. I'm fairly proficient with actionscript, php and css, I just don't know the syntax all involved here.

If anyone can point me in the right direction that would be appreciated. Sadly I can't simply switch it out with another lightbox that already has the option to print, as Joomla! K2 Extra Fields doesn't really give you that option. Help!