Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Michael Jensen 29 posts 98 karma points
    Jan 24, 2015 @ 22:55
    Michael Jensen
    0

    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:

    @inherits umbraco.MacroEngines.DynamicNodeContext

    @* 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 -->

     

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jan 25, 2015 @ 05:50
    Jan Skovgaard
    0

    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

  • Michael Jensen 29 posts 98 karma points
    Jan 25, 2015 @ 10:42
    Michael Jensen
    0

    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

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies