iam tryning to do a gallery ware images are listede on a category page ware a macro list all images, and to images large the images ned to popup.. but i cant ger image nr 2 to function , i belive it has som to do whirt the use om ID="pop".
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@ @if (Model.Children.Where("Visible").Any()) { <ul class="CleanURl"> @* For each child page under the root node, where the property umbracoNaviHide is not True *@ @foreach (var childPage in Model.Children.Where("Visible")) { <div class="ListGalleryMasterDiv"> <a href="#" id="pop" runat="server"><img class="ListGalleryImage" src="@childPage.image" /></a> <div id="overlay_form" style="display: none; z-index:100;"> <table> <tr> <td> <img class="GalleryImage" src="@childPage.image" /> </td> </tr> <tr> <td><a class="GalleryImageClose" href="#" id="close">Luk Billede</a></td> </tr> </table> </div> </div> } </ul> }
Script on master page
<!--Popup Script Start --> <script type="text/javascript"> $(document).ready(function () { //open popup $("#pop").click(function () { $("#overlay_form").fadeIn(1000); positionPopup(); }); //close popup $("#close").click(function () { $("#overlay_form").fadeOut(500); }); }); //position the popup at the center of the page function positionPopup() { if (!$("#overlay_form").is(':visible')) { return; } $("#overlay_form").css({ left: ($(window).width() - $('#overlay_form').width()) / 2, top: ($(window).width() - $('#overlay_form').width()) / 7, position: 'absolute' }); } //maintain the popup at center of the page when browser resized $(window).bind('resize', positionPopup); </script> <!--Popup Script Stop -->
Instead if targeting the unique id #pop, which you have put on all the image, which is not valid HTML since an id is unique you should change it so that you add a class of "pop" instead and then target the class in your script instead. So on the images in your HTML add class="pop" and in your javascript change $("#pop") to $(".pop")
Well i dos help abit but i dosent work i chance alle ID # to classe to not have a problem on macro java script and css. but nowe it only open the last img og all on the same time...
Thanks for trynning but i think i need to look at som fanzybox og one in that kinde..
Image Popup Problem
Hey,
iam tryning to do a gallery ware images are listede on a category page ware a macro list all images, and to images large the images ned to popup.. but i cant ger image nr 2 to function , i belive it has som to do whirt the use om ID="pop".
you can se it in action at this Webpage
It is the way i nowe howe to do.
Site information:
Umbraco v6.2.4 (Assembly version: 1.0.5394.15649)
running on CE database
Macro:
Script on master page
Hi Michael
Instead if targeting the unique id #pop, which you have put on all the image, which is not valid HTML since an id is unique you should change it so that you add a class of "pop" instead and then target the class in your script instead. So on the images in your HTML add
class="pop"
and in your javascript change$("#pop")
to$(".pop")
Hope this makes sense and helps.
/Jan
Hi Jan,
Well i dos help abit but i dosent work i chance alle ID # to classe to not have a problem on macro java script and css. but nowe it only open the last img og all on the same time...
Thanks for trynning but i think i need to look at som fanzybox og one in that kinde..
/Michael
is working on a reply...