Copied to clipboard

Flag this post as spam?

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


  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 11:23
    Keith Hubbard
    0

    Fancybox Intergration with v7.1.1 Image cropper

    I cannot seem to get the href to trigger the image url. I feel I am almost there but missing something, this worked great in v6 with CropUp. this is V7.1.1.

    <div class="Photo">
    @{
        // Get all child items based on the document type 'Gallery' and group them is 3
        <div class="photoGrid clearfix">
            @foreach (var group in Model.Content.Children.InGroupsOf(3))
            {           
                foreach (var item in group)
                {
                    // find you whether is the first item of the group and set through css class
                    var itemClass = item.IsFirst("first item left", "item left");
    
                    // tell images and links where to find sources of datatypes 
                    var src = @item.GetCropUrl("cropper", "thumbnail");
                    var photosrc = @item.GetCropUrl("cropper", "photo");
    
                    <div class="@itemClass">
                        <a class="fancybox" data-fancybox-group="gallery" href="@photosrc"><img src="@src" alt="@item.Name"/>@item.Name</a>
                        <span>@item.GetPropertyValue("PhotoText")</span>
                    </div>
                }
    
                // Clear after each group of 3
                <div class="clearBoth"> </div>
            }
        </div>
       }
    
     </div>    
    
  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    May 07, 2014 @ 11:31
    Jan Skovgaard
    0

    Hi Keith

    Is it possible to see this in action somewhere?

    And are you using the same jquery and fancybox version on this installation as you did previously?

    /Jan

  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 11:36
    Keith Hubbard
    0

    the development site is http://dev.concretefloorcoatingsva.com and I am using the same fancybox version 2.1.4 click on our work.

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    May 07, 2014 @ 11:47
    Jan Skovgaard
    1

    Hi Keith

    Is it the above code you're using on this site?

    When I look in the DOM I can't see the class="fancybox" on the <a> tag. Neither the data-fancybox-group="" attribute. Those missing is probably why - the interesting thing is to figure out why they're missing then :)

    /Jan

  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 11:58
    Keith Hubbard
    0

    Yes this is the code on the site. when you go to the our work page and select a gallery the link just points to the root. any ideas

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    May 07, 2014 @ 12:00
    Jan Skovgaard
    0

    Hi Keith

    Just to be clear - this page is where you can't get fancybox to play nice, right? http://dev.concretefloorcoatingsva.com/our-work/concrete-coatings/

    I see rel="gal" here but still no data-fancybox-grupt="" attribute?

    /Jan

  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 12:05
    Keith Hubbard
    0

    yes we are clear and i see the same you are asking.

  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 12:10
    Keith Hubbard
    0

    yes we are clear and i see the same you are asking. should i change the location of the fancybox files?

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    May 07, 2014 @ 12:41
    Jan Skovgaard
    101

    Hi Keith...

    Well I'm a bit puzzled that this line of code from your above example does not seem to render the same way in the source of the page I mentioned above

    <a class="fancybox" data-fancybox-group="gallery" href="@photosrc"><img src="@src" alt="@item.Name"/>@item.Name</a>
    

    If you take a look at the source code from your page you can see that the rendered <a> looks like this

    <a id="gallery" rel="gal" href="">image</a>
    

    So perhaps you need to change your script for initialzing fancybox or just double check that you're using the right razor-snippet in your installation.

    Hope this helps.

    /Jan

  • Keith Hubbard 174 posts 402 karma points
    May 07, 2014 @ 13:00
    Keith Hubbard
    0

    I resolved it and you are correct that i was modifying the wrong script.

  • Jan Skovgaard 11258 posts 23500 karma points MVP 7x admin c-trib
    May 07, 2014 @ 13:10
    Jan Skovgaard
    1

    Hi Keith

    Happy to hear you managed to get it all working - I know the feeling where you're modifying the wrong file and can figure out why things are not working. It happens to all of us :)

    Happy umbracoing mate.

    /Jan

  • Jeavon Leopold 3008 posts 13221 karma points MVP 7x admin c-trib
    May 07, 2014 @ 13:16
    Jeavon Leopold
    2

    Awesome it's all working now!

    One little extra suggestion, when you have code blocks you shouldn't use the @ within them

    e.g.

    var src = @item.GetCropUrl("cropper", "thumbnail");
    var photosrc = @item.GetCropUrl("cropper", "photo");
    

    should be

    var src = item.GetCropUrl("cropper", "thumbnail");
    var photosrc = item.GetCropUrl("cropper", "photo");
    

    It will save you from potential problems later

    Jeavon

  • 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