Tagged: ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #458288

    Hi,

    I’d like to know if it is possible to have a direct link to a portfolio grid where one set item is already open, in the ajax view.

    Thanks

    #458714

    Hey adetec_ing!

    Thank you for using Enfold.

    Add this in the functions.php file to trigger click event for the first portfolio grid item on page load:

    function ava_auto_click_portfolio() {
    ?>
    <script>
    (function($){
      $(window).on('load', function(){
        $('div .isotope-item:first-child .grid-image').trigger('click');
      });
    })(jQuery);
    </script>
    <?php
    }
    
    add_action('wp_footer', 'ava_auto_click_portfolio');

    Cheers!
    Ismael

    #459257

    Thanks for your answer, but I need to select one or another, depending on the link. For example:

    http://www.example.com/ajaxgrid#item4

    I guess that if not directly, it could be achieved with a POST or a GET, but I’m quite bad with jQuery and don’t know to modify this part.

    Thanks.

    #459882

    Hi!

    I guess you need something like this: https://kriesi.at/support/topic/linking-to-filtered-portfolio-ajax/#post-430830

    You can change the javascript there with the code above. And use nth-child selector to choose which items to open, example, “div .isotope-item:nth-child(4) .grid-image” for the 4th item. The code is a bit cumbersome and can be improved so I suggest hiring a freelance developer to create new script for it. You can visit codeable: http://kriesi.at/contact/customization

    Regards,
    Ismael

    #461024

    Hi, thanks for the information, although I’m not sure if this nth-child would work as the order may change.
    Using an id or class based selector would be perfect, so I guess this should work:

    
    function ava_auto_click_portfolio() {
    ?>
    <script>
    (function($){
      $(window).on('load', function(){
        $('.post-entry-1111 .grid-image').trigger('click');
      });
    })(jQuery);
    </script>
    <?php
    }
    
    add_action('wp_footer', 'ava_auto_click_portfolio');
    

    Can’t test it right now, but I think it would work.

    • This reply was modified 8 years, 9 months ago by adetec_ing.
    #461104
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.