I have a problem using jQuery and prettyPhoto (plugin for wordpress)! My problem is that i want to get image description from a hidden div, outside the already working a tag. This is what i have so far:
<div class="portfolie_short_content_containe">
<a class="lightbox" style="text-decoration: none;" rel="lightbox" href="<?php echo $image[0]; ?>" title="<?php echo $image_desc; ?>">
<span class="hover">
<div class="portfolio_thump_hover_text">
<span class="lable"><?php echo $short_descr;?></span><br>
<span class="lable"><?php echo $link;?></span><br>
<span class="lable"><FONT style="color : #f47b42;">Se CV</FONT></span>
</div>
</span>
<img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" alt="<?php echo $image_alt; ?>"></img>
</a>
<!-- hidden div containing description -->
<div id="lightbox" style="display: none"><p><?php echo $full_descr; ?></p><div>
</div>
And the jQuery.prettyphoto.js file looks like this!
theRel = $(this).attr('rel');
galleryRegExp = /\[(?:.*)\]/;
isSet = (galleryRegExp.exec(theRel)) ? true : false;
var x = 500;
var elmtid = $(this).attr('class');
// Put the SRCs, TITLEs, ALTs into an array.
pp_images = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
if ($(n).attr('rel').indexOf(theRel) != -1)
return $(n).attr('href');
}) : $.makeArray($(this).attr('href'));
pp_titles = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
if ($(n).attr('rel').indexOf(theRel) != -1)
return ($(n).find('img').attr('alt')) ? $(n).find('img').attr('alt') : "";
}) : $.makeArray($(this).find('img').attr('alt'));
//Get text from hidden dir!
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
if ($(n).attr('rel').indexOf(theRel) != -1)
return ($(n).find('p').text()) ? $(n).find('p').text() : "";
}) : $.makeArray($(this).find('p').text());
I’m not that experienced in jQuery. Can anyone help to get hold of the description? I have tried something like this!
pp_descriptions = (isSet) ? jQuery.map(matchedObjects, function(n, i) {
if($(n).attr('class') != -1)
return ($('#'+elmtid).html()) ? $('#'+elmtid).html() : \"\";
}) : $.makeArray($('#'+elmtid).html());
But it didn’t work.
Solved it, maybe easy but first time working jQuery!
IN the js file i changed this.
It is not perfect but it works hope it helps other people with same issue.