Sign Up! Login: Password: New User? Forgot? Support
Top Mods!
Wowhead Search
by sonofsamedi
Digital Clock
by Wolfar15
Admin Forums
Welcome to the GuildPortal Help Community! These forums are for admin-to-admin help.
Available Forums
Forums : Voodoo Tech and Scripter's Den of Scriptniquity > Dynamically adding facebox popup to images posted to GP forum
_Shulkie_ (Guild Admin) 4/27/2010 3:41 PM EST : Dynamically adding facebox popup to images posted to ...
_Shulkie_
Posts: 467
Fingers of Fury!

I added CSS to force images posted to our forum to be a max of 500px wide, but have been wracking (or wrecking?!?) my brain trying to figure out how to dynamically add the popup functionality to the images so they can be seen fullsize.

After digging into the jquery docs and the GP CSS i came up with the code below

what it does is cycles through all images which are descendants of page elements with the class ".MessageBodyCell1" but that are not descendants of ".MessageSignature" and adds an onclick event which pops open a facebox window with the original image in it

useful? or already covered
     
$(document).ready(function() {                                  
$( ".MessageBodyCell1 img" ).not('.MessageSignature img').each(function(){                                  
$( this ).bind ("click",function(){ jQuery.facebox({ image: $( this ).attr("src")});});                                  
});                                  
});                                  
Cheers, Shulkie
TopBottom

Mottie (MVP) 4/30/2010 5:53 PM EST : RE: Dynamically adding facebox popup to images posted...
GuildPortal MVP
Mottie
Posts: 3883
Zomgawsh Poster

Hi _Shulkie_!

Very nice! Would you mind reposting this on my help site or if I did? I'm trying to keep everything organized to make it easier for users to find useful code/scripts!
TopBottom

_Shulkie_ (Guild Admin) 5/1/2010 5:15 AM EST : RE: Dynamically adding facebox popup to images posted...
_Shulkie_
Posts: 467
Fingers of Fury!

no probs. done
Cheers, Shulkie
TopBottom

Admins Online
There are   members online.
So-and-so has logged on!
%title%
%message%