Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #20199

    I was wondering if there’s somewhere in the code where I can use a function to call the last state of the dynamic portfolio?

    For instance, I have [img 1][img 2][img 3][img 4]showing in the dynamic portfolio. I first click on[img 2]thumbnail and img 2 slides. Then I use the navigation to hit ‘next’ twice, so[img 3]and then[img 4]slides in. There must be an array or variable somewhere which holds the previous state (clicking thumbnail or the navigation) of portfolio to slide in, no? I would like to call it in a function I am currently writing. I hope this is clear. Thanks for all the help so far. You’ve all been very helpful.

    #106641

    Hi,

    You want to be able to tell on every ajax powered portfolio-item page whether the visitor reached that page from another portfolio item page or from the main portfolio archive page.

    There is an array that holds the order of the portfolio after it is sorted so that when the next or previous arrow is clicked , the correct portfolio item is shown. If you look at the source code of any ajax portfolio page, the section of the source code that looks like the code below (just with a different number of ajax ‘pages’ or slides and different id numbers) would be present that dictates the order of the sorted portfolio items with the first one always being where the visitor landed from the archive page.

    <div class="portfolio-details-inner" style="">
    <div class="ajax_slide ajax_slide_474" data-slide-id="474" style="">data for this slide</div>
    <div class="ajax_slide ajax_slide_233 open_slide" data-slide-id="233" style="z-index: 3; left: 0%; -webkit-transition: none; opacity: 1;">
    <div class="ajax_slide ajax_slide_244" data-slide-id="244" style="">data for this slide</div>
    <div class="ajax_slide ajax_slide_571" data-slide-id="571" style="">data for this slide</div>
    </div>

    The first (ajax_slide) is always the portfolio slide that was used to enter the portfolio item page initially, which in the case of the above example is 474. In the above example the visitor is on the second slide, so you can be 100% sure that the visitor arrived there only by hitting the Next/Previous buttons. Why?

    You can see it has an ‘open_slide’ class while the other <div>’s don’t, and it is the second ajax_slide div, when we know that the first ajax_slide div has to be where the entry is made from the archive. Since the first div doesn’t have the open_slide class, we know that in this instance the visitor already hit the next button (or previous a few times) to reach this slide.

    So if that class is located on any div except the first one (except 474), you can be 100% sure that a next/previous button was used to access that page. If the open_slide class is on the first div though, you can not guarantee that it was entered from the portfolio archive because if you keep hitting the next/prev arrows the visitor will eventually loop around and return to 474.

    You can use Jquery to check which child div of portfolio-details-inner currently has the open_slide class programmatically and thereby know how the page was reached. There are another dozen ways you can learn the information you need, but you will need to modify a portion of the theme to record that information yourself.

    However that is outside the scope of the support team.

    Thanks,

    Nick

    #106642

    Awesome. Thanks for pointing me in the right direction. Most of the pieces are falling into place.

    #106643

    Hi!

    Glad that Nick could help you :)

    Best regards,

    Peter

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘dynamic portfolio function go backwards’ is closed to new replies.