I am absolutly perplexed. I'm trying to create a user submitted classifieds site, so users can sell items. I would just like for the user to be able to submit photos and then have them display in a lightbox.
I downloaded a simple lightbox gallery into dreamweaver then uploaded the site to BC. It came with demo images and worked fine (code below):
<div id="gallery1" class="lbGallery">
<ul>
<li> <a href="images/lightboxdemo1.jpg" title=""> <img src="images/lightboxdemo_thumb1.jpg" width="72" height="72" alt="" /> </a> </li>
<li> <a href="images/lightboxdemo2.jpg" title=""> <img src="images/lightboxdemo_thumb2.jpg" width="72" height="72" alt="" /> </a> </li>
<li> <a href="images/lightboxdemo3.jpg" title=""> <img src="images/lightboxdemo_thumb3.jpg" width="72" height="72" alt="" /> </a> </li>
<li> <a href="images/lightboxdemo4.jpg" title=""> <img src="images/lightboxdemo_thumb4.jpg" width="72" height="72" alt="" /> </a> </li>
<li> <a href="images/lightboxdemo5.jpg" title=""> <img src="images/lightboxdemo_thumb5.jpg" width="72" height="72" alt="" /> </a> </li>
</ul>
</div>
<script type="text/javascript">
// BeginWebWidget lightbox_gallery
$(function() {
$('#gallery1 a').lightBox();
});
// EndWebWidget lightbox_gallery
</script>
The tags for my photos are {tag_main photo}, {tag_photo#2} and so on to photo#5. I had hoped that I could just delete the current image source and input my tags and the lightbox would function however it does not. When I examine the code on the displayed page it shows that the tag does something like this...... <img src="src=........in other words the tag element supplies the command "src=" and messes things up. If I remove the original src= command BC automatically alters the code and everything gets messed up.
Does anyone have any ideas, or even idiot proof code I could use (I'm still figuring this out and probably can't handle intense coding)
Thanks
Hey there,
Not sure what you mean exactly but are you saying your doing this:
<img src="{tag_customfieldimage}" width="72" height="72" alt="" />
But it renders all messed up?
This is because that image custom field tag by default will render the full html of an image.
If you want to just get the value of the image use..
{tag_customfieldimage_value}Thanks Liam but the size isn't the issue, it's that the {tag_customfieldimage} supplies the command src=" so the code ends up reading src="src="/image/......If I can figure out how to make the {tag_customfieldimage} from including the command src= so it basically just provides a path to the file without a command that would probably work. But, if I do that I'm afraid there are other areas of the site that will be messed up by changing the code.
Any help would be greatly appreciated.
Hi dpd5143,
Liams answer is what you are looking for though.
If you want to achieve this:
<li> <a href="images/lightboxdemo1.jpg" title=""> <img src="images/lightboxdemo_thumb1.jpg" width="72" height="72" alt="" /> </a> </li>
you need to do something like this:
<li><a href="{tag_main photo_value}" title=""><img src="{tag_main photo_value}?Action=thumbnail&Width=72&Height=72" alt="" /></a></li>
Nicole - BCGurus.com
First, thank you both very much. I realize this question is probably very elemenatry but I'm still getting the feel for these features (such as lightbox) and as you can tell, having some difficulty. I updated the code as you both suggested and it brought me one step closer, the pictures now display in the web app as desired (here's the page http://yourboatconnection.businesscatalyst.com/boat-classifieds-1/3245 53425 ). I'm still having as issue though. When I click on them instead of opening up into the lightbox, as they do in the Live View in Dreamweaver, they now just open up full size in a new tab. Maybe I don't fully understand how to implement the code supplied with the widget but I added the below code into the CSS. Below that is the current, updated web app code. Maybe there is something obvious that one of you can see. I just want a simple thing to present the expanded pictures, I really didn't think this was going to be that difficult -silly me! Thanks again.
Plug-in Code:
/**
* jQuery lightBox plugin
* This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
* and adapted to me for use like a plugin from jQuery.
* @name jquery-lightbox-0.5.css
* @author Leandro Vieira Pinho - http://leandrovieira.com
* @version 0.5
* @date April 11, 2008
* @category jQuery plugin
* @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
* @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
* @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
*/
#jquery-overlay {
position: absolute;
top: 0;
left: 0;
z-index: 90;
width: 100%;
height: 500px;
}
#jquery-lightbox {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: 100;
text-align: center;
line-height: 0;
}
#jquery-lightbox a img { border: none; }
#lightbox-container-image-box {
position: relative;
background-color: #fff;
width: 250px;
height: 250px;
margin: 0 auto;
}
#lightbox-container-image { padding: 10px; }
#lightbox-loading {
position: absolute;
top: 40%;
left: 0%;
height: 25%;
width: 100%;
text-align: center;
line-height: 0;
}
#lightbox-nav {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 10;
}
#lightbox-container-image-box > #lightbox-nav { left: 0; }
#lightbox-nav a { outline: none;}
#lightbox-nav-btnPrev, #lightbox-nav-btnNext {
width: 49%;
height: 100%;
zoom: 1;
display: block;
}
#lightbox-nav-btnPrev {
left: 0;
float: left;
}
#lightbox-nav-btnNext {
right: 0;
float: right;
}
#lightbox-container-image-data-box {
font: 10px Verdana, Helvetica, sans-serif;
background-color: #fff;
margin: 0 auto;
line-height: 1.4em;
overflow: auto;
width: 100%;
padding: 0 10px 0;
}
#lightbox-container-image-data {
padding: 0 10px;
color: #666;
}
#lightbox-container-image-data #lightbox-image-details {
width: 70%;
float: left;
text-align: left;
}
#lightbox-image-details-caption { font-weight: bold; }
#lightbox-image-details-currentNumber {
display: block;
clear: left;
padding-bottom: 1.0em;
}
#lightbox-secNav-btnClose {
width: 66px;
float: right;
padding-bottom: 0.7em;
}#gallery1 {
}
Web App Code (for the photos):
<div id="gallery1" class="lbGallery">
<ul>
<li><a href="{tag_main photo_value}"><img alt="" src="{tag_main photo_value}?Action=thumbnail&Width=250&Height=250" /></a></li>
<li><a href="{tag_photo#2_value}"><img alt="" src="{tag_photo#2_value}?Action=thumbnail&Width=250&Height=25 0" /></a></li>
<li> <a href="{tag_photo#3_value}"><img alt="" src="{tag_photo#3_value}?Action=thumbnail&Width=250&Height=25 0" /></a> </li>
<li> <a href="{tag_photo#4_value}"><img alt="" src="{tag_photo#4_value}?Action=thumbnail&Width=250&Height=25 0" /></a> </li>
<li> <a href="{tag_photo#5_value}"><img alt="" src="{tag_photo#5_value}?Action=thumbnail&Width=250&Height=25 0" /></a> </li>
</ul>
<script type="text/javascript">
// BeginWebWidget lightbox_gallery
$(function() {
$('#gallery1 a').lightBox();
});
// EndWebWidget lightbox_gallery
</script>
</div>
You have a javascript error:
Error: $ is not a function
Source File: http://yourboatconnection.businesscatalyst.com/boat-classifieds-1/3245 53425
Line: 273
You declared jQuery to be noConflict but then not using the noConflict method, still doing just $.
Okay, the code below still isn't working but hopefully I'm coming closer. (Nothing like CSS to make an otherwise confident person feel like an idiot.)
</ul>
<script type="text/javascript">
// BeginWebWidget lightbox_gallery
$j = jQuery.noConflict();
$j(function() {
$j('#gallery1 a').lightBox();
});
// EndWebWidget lightbox_gallery
Where am I going wrong?
Hi,
your reference to the script and css files in you source code is not correct (line 19, 20, 181, and 182), you can not link to a local file on your computer, you will need to upload the lightbox js and css to the BC site.
Also, your a-tags need the rel-attribute:rel="lightbox".
Check out the source code in my sandbox: http://nicolessandbox.hotpressplatform.com/lightbox-test.html
Nicole - BCGurus.com
Thanks Nicole. I know you could not have idiot proofed this any more, but I still just cannot get it to work and have run out of time to mess with it. I see you're with BCGurus, their site says I can hire an expert for $99 for a half hour, I can't fathom this problem going for longer than that. If that is something you would be interested in please let me know. Thanks.
North America
Europe, Middle East and Africa
Asia Pacific