javascript - Jquery Image AND link swap using same variable? -


i have product page has multiple images, large image shown in main box, , thumbnails of additional images underneath. when clicking on main image, fancybox fires , see larger image in lightbox effect.

i'm using jquery swap out images on page, , works fine:

<script> $('#thumbs').delegate('img','click', function(){ $('#largeimage').attr('src',$(this).attr('src').replace('width=80&height=80','width=470&height=525')); }); </script> 

and code in main area:

<div class="prodrightcolumn">     <div class="productmainimage" id="panel">         <a id="largelink" href="~/images/@product.image1"  rel="gallery2" class="fancybox" title="@product.title">             <img id="largeimage" src="~/images/@product.image1?width=470&height=525&mode=crop" alt="@product.title" />         </a>     </div>          <div id="thumbs">             @if (product.image1 != ""){<div class="productsmallimage"><img src="~/images/@product.image1?width=80&height=80&mode=crop" alt="@product.title" /></div>}                     @if (product.image2 != ""){<div class="productsmallimage"><img src="~/images/@product.image2?width=80&height=80&mode=crop" alt="@product.title" /></div>}             @if (product.image3 != ""){<div class="productsmallimage"><img src="~/images/@product.image3?width=80&height=80&mode=crop" alt="@product.title" /></div>}             @if (product.image4 != ""){<div class="productsmallimage"><img src="~/images/@product.image4?width=80&height=80&mode=crop" alt="@product.title" /></div>}             @if (product.image5 != ""){<div class="productsmallimageend"><img src="~/images/@product.image5?width=80&height=80&mode=crop" alt="@product.title" /></div>}         </div>     </div> 

what need change link in lagelink id fancybox open correct image, , not default first image. i've tried:

$('#largelink').attr('href',$(this).attr('href')); 

but it's not working. i'm not familiar jquery, i'm feeling way around. i've tried reading on blogs i'm not getting it, either need more coffee or appreciated helping hand if possible.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -