Forum Replies Created

Viewing 30 posts - 1 through 30 (of 48 total)
  • Author
    Posts
  • in reply to: Image with hotspots that open image in lightbox #1356504

    Hi Rikard
    You can close the topic. Thanks for Mike’s and Guenni007’s support.
    Kind regards
    Ueli

    in reply to: Image with hotspots that open image in lightbox #1355743

    Thanks Guenni007
    I can live with Mike‘s solution.
    Kind regards
    Ueli

    in reply to: Image with hotspots that open image in lightbox #1355617

    Hi Mike and Guenni007

    Thanks a lot for your help and contributions.

    Reply on Mike’s https://kriesi.at/support/topic/image-with-hotspots-that-open-image-in-lightbox/#post-1355277
    This solution also works well.

    Your new approach in using the tooltip text is a very nice idea. It’s more convenient to write and edit this text within the hotspot element than editing it in the child’s functions.php. WP authors without access to the functions.php would not able to edit this text if I used the initial approach.

    I implemented Mike’s version (https://kriesi.at/support/topic/image-with-hotspots-that-open-image-in-lightbox/#post-1355413) on my website:

    function popup_tooltips_with_links_erdgeschoss() { 
    if(is_page(559)) {
    ?>
    <script type="text/javascript">
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
       $('#top.page-id-559 .av-image-hotspot_inner').each(function () {
       	var toolTip = $(this).closest('.av-image-hotspot').attr('data-avia-tooltip');
        var cleanTitle =  $(toolTip).text();
    	$(this).attr('title', cleanTitle );
    	$(this).magnificPopup({
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    });
    })(jQuery);
    });
    </script>
    <?php }
    									 }
    add_action('wp_footer', 'popup_tooltips_with_links_erdgeschoss');
    
    function popup_tooltips_with_links_obergeschoss() { 
    if(is_page(561)) {
    ?>
    <script type="text/javascript">
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
       $('#top.page-id-561 .av-image-hotspot_inner').each(function () {
       	var toolTip = $(this).closest('.av-image-hotspot').attr('data-avia-tooltip');
        var cleanTitle =  $(toolTip).text();
    	$(this).attr('title', cleanTitle );
    	$(this).magnificPopup({
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    });
    })(jQuery);
    });
    </script>
    <?php }
    									 }
    add_action('wp_footer', 'popup_tooltips_with_links_obergeschoss');
    
    function popup_tooltips_with_links_dachgeschoss() { 
    if(is_page(563)) {
    ?>
    <script type="text/javascript">
    window.addEventListener('DOMContentLoaded', function() {
    (function($){
       $('#top.page-id-563 .av-image-hotspot_inner').each(function () {
       	var toolTip = $(this).closest('.av-image-hotspot').attr('data-avia-tooltip');
        var cleanTitle =  $(toolTip).text();
    	$(this).attr('title', cleanTitle );
    	$(this).magnificPopup({
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    });
    })(jQuery);
    });
    </script>
    <?php }
    									 }
    add_action('wp_footer', 'popup_tooltips_with_links_dachgeschoss');

    Actually, there are three floor plans. That’s why I use the script three times (with slightly different function names) and address it to the corresponding page id.

    For all of those who want to see how a house tour with floor plans might be realized with Enfold’s image with hotspots media element, here is the link:
    http://www.ferienhaus-alpina.ch/hausbesichtigung


    @Guenni007
    : I’ve also tried your version (https://kriesi.at/support/topic/image-with-hotspots-that-open-image-in-lightbox/#post-1355426) but it didn’t work. Like Mike’s report, the lightbox opens but no image is shown. Any idea how your version could run on my site?

    Kind regards
    Ueli

    in reply to: Image with hotspots that open image in lightbox #1355272

    @guenni007: PAGE ID 1, PAGE ID 2 and PAGE ID 3 are just placeholders!

    in reply to: Image with hotspots that open image in lightbox #1355259

    Hi Mike

    Excellent! It works like a charm.

    I have 3 floor plans on 3 different pages. So, the hotspot element is used three times. That’s why I completed your code with if elseif statements and is_page(PAGE ID) conditionals:

    function custom_hotspot_title_script() {
    if(is_page(PAGE ID 1)) {
    ?>
      <script>
    (function($){
    $('.av-image-hotspot-1 a').attr('title','hotspot-1');
    $('.av-image-hotspot-2 a').attr('title','hotspot-2');
    $('.av-image-hotspot-3 a').attr('title','hotspot-3');
    $('.av-image-hotspot-4 a').attr('title','hotspot-4');
    $('.av-image-hotspot-5 a').attr('title','hotspot-5');
    $('.av-image-hotspot-6 a').attr('title','hotspot-6');
    $('.av-image-hotspot-7 a').attr('title','hotspot-7');
    $('.av-image-hotspot-8 a').attr('title','hotspot-8');
    $('.av-image-hotspot a').magnificPopup({ 
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    })(jQuery);
    </script>
      <?php
    }
    elseif (is_page(PAGE ID 2)) {
    ?>
      <script>
    (function($){
    $('.av-image-hotspot-1 a').attr('title','hotspot-1');
    $('.av-image-hotspot-2 a').attr('title','hotspot-2');
    $('.av-image-hotspot-3 a').attr('title','hotspot-3');
    $('.av-image-hotspot-4 a').attr('title','hotspot-4');
    $('.av-image-hotspot-5 a').attr('title','hotspot-5');
    $('.av-image-hotspot-6 a').attr('title','hotspot-6');
    $('.av-image-hotspot-7 a').attr('title','hotspot-7');
    $('.av-image-hotspot-8 a').attr('title','hotspot-8');
    $('.av-image-hotspot-9 a').attr('title','hotspot-9');
    $('.av-image-hotspot-10 a').attr('title','hotspot-10');
    $('.av-image-hotspot-11 a').attr('title','hotspot-11');
    $('.av-image-hotspot-12 a').attr('title','hotspot-12');
    $('.av-image-hotspot-13 a').attr('title','hotspot-13');
    $('.av-image-hotspot-14 a').attr('title','hotspot-14');
    $('.av-image-hotspot-15 a').attr('title','hotspot-15');
    $('.av-image-hotspot-16 a').attr('title','hotspot-16');
    $('.av-image-hotspot-17 a').attr('title','hotspot-17');
    $('.av-image-hotspot a').magnificPopup({ 
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    })(jQuery);
    </script>
      <?php
    }
    elseif (is_page(PAGE ID 3)) {
    ?>
      <script>
    (function($){
    $('.av-image-hotspot-1 a').attr('title','hotspot-1');
    $('.av-image-hotspot-2 a').attr('title','hotspot-2');
    $('.av-image-hotspot-3 a').attr('title','hotspot-3');
    $('.av-image-hotspot-4 a').attr('title','hotspot-4');
    $('.av-image-hotspot-5 a').attr('title','hotspot-5');
    $('.av-image-hotspot-6 a').attr('title','hotspot-6');
    $('.av-image-hotspot-7 a').attr('title','hotspot-7');
    $('.av-image-hotspot-8 a').attr('title','hotspot-8');
    $('.av-image-hotspot a').magnificPopup({ 
        type: 'image',
        image: {
            titleSrc: 'title' 
        }
    });
    })(jQuery);
    </script>
      <?php
    }
    }
    add_action('wp_footer', 'custom_hotspot_title_script');

    The code seems to work well but I’m not sure if it is state of the art. Maybe you can provide a shorter version that does the same job?

    Kind regards
    Ueli

    • This reply was modified 2 years, 5 months ago by Ueli.
    in reply to: Image with hotspots that open image in lightbox #1355078

    Hi Mike

    It exactly is the problem that the lightbox has an empty title field. Even though I add text in the image title field in the media library, that text won’t be displayed as a caption in the lightbox.

    Just to be clear how the image with hotspots media element opens image-links in the lightbox. Within the settings of a specific hotspot I set under “Anvanced” the hotspot link to manually, add the link of the image that has to be opened in the lightbox and set the link to be opened in the same window (see screenshot in private content).

    On the frontend the link of hotspot number 7 looks for example like this:
    <a href="https://www.mydomain.com/wp-content/uploads/2021/10/seminarraum.jpg" class="av-image-hotspot_inner lightbox-added">7</a>
    If the link is an image, Enfold adds automatically the class lightbox-added by default.
    If the link is a webpage…
    <a href="https:// www.mydomain.com " class="av-image-hotspot_inner">7</a>
    …then there is no class lightbox-added.
    So, the class lightbox-added triggers the lightbox.

    The whole concept of the image with hotspots media element is different to the masonry gallery media element where you have thumbnail images with the title attribute – taken from the media library – that is obviously sent to the lightbox. The image with hotspots media element only shows hotspots made with CSS that have no title attribute of the image they are linking to. That’s why no title can be sent to the lightbox.

    At least this is my interpretation of what’s going on and it seems to be complicated.

    Is there still a way to have captions if I link from a hotspot to an image that opens in the lightbox?

    Kind regards
    Ueli

    Hi Ismael

    Right now, I can live with the current state. It might be a claim or a goal for Enfold‘s developers to bring the accordion‘s behavior to perfection in a future update.

    Thank you very much for your help and your patience with a picky customer.

    Kind regards
    Ueli

    Hi,


    @guenni007
    : I was brave and put my modified class-avia-masonry.php into the enfold-child/shortcodes. The self-destruction mechanism wasn’t triggered and thanks to Enfold’s warp drive, the modifications work well😉.
    Thanks for your help.

    @Günter: Thanks for your additional explanation.

    Kind regards
    Ueli

    Hi Guenni

    Do I understand you correctly? I just have to make my customizations in a copy of the new class-avia-masonry.php and upload that altered file to the enfold-child/shortcodes folder and then it is used instead of the original file? Do I also have to create a subfolder avia-shortcode-helpers because the original file is in a directory called like that?

    And what exactly do you want to explain with…
    if ( ! class_exists( 'avia_masonry_old' ) )
    …in the older file? I found that code but what exactly does it? If I have to work with the new file, why does the older file still exist?

    Sorry, I just know little basics of PHP and don’t understand the concept of classes yet.

    Kind regards
    Ueli

    Hi Ismael

    The code is working now quite well.

    But there is a new issue with the first toggle “Schulen und Gruppen im Lager”. The long title gets a line break on small screens (less than 447px) what makes the toggle higher. As a result, the toggle isn’t completely visible when I open it. It’s partially cut by the upper screen border. All other toggles stay completely visible when activated. Why does this happen? Isn’t the upper border of a toggle the reference point of the offset?

    I realize, that the whole concept of the accordion’s mode “one toggle open at a time” in combination with a sticky header stays very tricky.

    Kind regards
    Ueli

    Hi Ismael
    The code looks now like this…

     //check if toggle title is in viewport. if not scroll up
    				    var el_offset = content.offset().top,
    				        scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
    				    
    				        $scoll_target_offset = $(window).width() < 768 ? 10 : 100;
    $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target - $scoll_target_offset},200);

    …but it doesn’t work. I can open and close one toggle but no other toggle can be opened.
    Kind regards
    Ueli

    Hi Ismael

    Your new code…

     //check if toggle title is in viewport. if not scroll up
    	var el_offset = content.offset().top,
    	scoll_target = el_offset - 50 - parseInt($('html').css('margin-top'),10);
    	$scoll_target_offset = 100;
    
    if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
       	$scoll_target_offset = 10;
    }
    
    $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target - $scoll_target_offset},200);
    }

    … doesn’t work either.

    And how reliable is your approach of device detection?
    Wouldn’t it be easier to make the code dependent of the screen width – as I’ve written in my initial post – because the header isn’t sticky if the screen width is less than 768px, regardless of the device?

    We know that the code mentioned in my initial post is doing well with a sticky header.
    Couldn’t we change the line…

    $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target - 100},200);
    

    …to something like that?

    if ($(window).width() < 768) {				    
    $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target - 10},200);
    } else {
    $('html:not(:animated),body:not(:animated)').animate({scrollTop: scoll_target - 100},200);
    				}

    Before, shouldn’t there be a declaration of the variable var width = $(window).width()? But I don’t know where exactly.

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1353139

    Hi Mike

    OK, I prefer the first approach while assigning the script to the pages where it is needed.
    Thanks for your and Ismael’s help.

    Kind regards
    Ueli

    Hi Ismael

    The new code doesn’t work. I can open and close a toggle once but then no toggle can be opened again. Please see Link in Private Content.

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1352542

    Hi Mike

    That approach also works well. How does the code look like if I want to affect a second and third anchor – e. g. #beitraege and #berichte?

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1352436

    Hi Mike

    Your modification works well so far.

    But I ran into several new issues because the scrolling script affects now every link/anchor with a # on my website. For example there is a link with a # that opens the lightbox containing a contact form. While the lightbox is opening in the foreground, the page scrolls back to the top in the background instead of staying in place.

    I fixed these issues in completing your code with a if(is_page(PAGE ID)) conditional.

    function custom_offset_script_with_width() {
    if(is_page(972)) {
    ?>
        <script>
    (function($) {
      $('a[href*=#]:not([href=#])').click(function() {
      	var width = $(window).width()
        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') 
    && location.hostname == this.hostname) {
    
          var target = $(this.hash);
          target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
          if (target.length) {
          	if ($(window).width() < 768) {
            $('html,body').animate({
              scrollTop: target.offset().top - 10 //offset if header isn't sticky
            }, 1000);
            return false;
          } else {
          	$('html,body').animate({
              scrollTop: target.offset().top - 100 //offset if header is sticky
            }, 1000);
            return false;
          }
          } 
        }
      });
      //Executed on page load with URL containing an anchor tag.
      if($(location.href.split("#")[1])) {
          var target = $('#'+location.href.split("#")[1]);
          if (target.length) {
          	if ($(window).width() < 768) {
            $('html,body').animate({
              scrollTop: target.offset().top - 10 //offset if header isn't sticky here too.
            }, 1000);
            return false;
          } else {
          	$('html,body').animate({
              scrollTop: target.offset().top - 100 //offset if header is sticky here too.
            }, 1000);
            return false;
          }
          } 
        }
    }(jQuery));
    </script>
        <?php
    }
    }
    add_action('wp_footer', 'custom_offset_script_with_width');

    The script runs now only on the specific page where it is needed. That works fine for me.

    Another approach might be that your initial script affects only a specific anchor – #webcams in my case – instead of affecting every anchor with a #. How can this be achieved?

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1352130

    Hi Mike

    Thanks! Your solution seems to work on all major browsers and I might live with that scrolling approach. But if the header isn’t sticky, like on smaller screens (width less than 768px), there must be a smaller offset. The code needs to be completed with a dependency of the screen width. For example, if the screen width is 768px or more then the offset is 80px and if the screen width is less than 768px then the offset is 10px. How can this be achieved?

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1351681

    Hi Ismael

    I’m at a loss and a bit desperate.

    I don’t understand why it should work well on your side but all of my colleagues (at least 4 people with different computers on different locations) report the same misbehavior that I’m talking about. If you click the “Webcams”-link on the homepage at a very first visit, the corresponding anchor title “Webcams” on the webpage “Aktuelles” stays covered by the sticky header. Please see new screen videos of Firefox and Chrome in Private Content. We always clear the cache and hard refresh the homepage before making the tests. The videos also show that if you go back and forth then the scrolling position is correct. But on an initial load (a very first visit) the offset script is not fired correctly.

    Kind regards
    Ueli

    Hi Ismael

    Thanks for your clarification. The modified JS file is now loaded correctly from my Child Theme directory.

    I will open a new thread for my additional question even though I see it as a part of this topic because it is caused by the solution you have provided.

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1350893

    Hi Ismael

    I have completely removed the webcams to find out if it works at least with only title and text. Unfortunately it doesn’t. Both on Firefox and on Chrome the title is mostly covered by the header. I have tested on several windows desktop computers and even friends can reproduce the issue. It seems to work on iPad’s Safari.

    What else can you do?

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1348873

    Hi Ismael

    It’s definitely not working correctly! Of course, I always purge the cache or remove the browser history before checking the page.

    Based on your screenshot, I assume you were using the Chrome browser and you were logged in the WordPress backend while testing the site. I’ve just found out if you do so, the issue seems gone. But if you are not logged in the backend while testing the site, the sticky header covers the title most of the time. However, if I repeat the test over and over again, it very rarely works. This observation applies to Chrome. With Firefox it doesn’t really matter if you are logged in the backend or not. Most of the times, the title stays covered.

    So please test the site again without being logged in the backend.

    Kind regards
    Ueli

    in reply to: Toggles of accordions are covered by the sticky header #1348523

    Hi Ismael

    I’m not sure if I understand you right.

    According to the documentation on https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb I’ve added to my Child Theme the specific function to the functions.php and the new folder shortcodes with the subfolder toggles and the two files toggles.js and toggles.php.

    The documentation says that If you copy an element from enfold>config-templatebuilder>avia-shortcodes to the folder shortcodes it will replace the one in the parent and be used instead. Since the crucial changes are in toggles.js, why do I have to edit toggles.php as well? And what do you mean with you have to update the script path in toggles.php? Do you mean the part avia-schortcodes/toggles/toggles/toggles.js because in my Child Theme the folder is called shortcodes instead of avia-shortcodes? And what is with the path of the CSS file since I haven’t copied it to my Child Theme? Do I still have to replace avia-shortcodes with shortcodes there?

    And please answer my first question from my last post:

    Your latest code causes another thing. The offset is now the same on desktop and mobile view. Is it possible to have a different offset value on mobile view when the header isn’t sticky?

    Kind regards
    Ueli

    in reply to: Sticky header covers content of destination anchor #1348520

    Hi Ismael

    I put the content into a color section, removed the ID “webcams” from the h2 title tag and applied it to the color section. The issue still consists.

    I have just realized that on Enfold’s Support Website anchor IDs seem to work properly with the sticky header. See further details in Private Content.

    I guess that Enfold’s Support Forum also runs with the Enfold Theme. So why does it work there but not on my website?

    Kind regards
    Ueli

    in reply to: Toggles of accordions are covered by the sticky header #1347775

    Hi Ismael

    OK, I can live with that.

    Your latest code causes another thing. The offset is now the same on desktop and mobile view. Is it possible to have a different offset value on mobile view when the header isn’t sticky?

    I’ve also found out, after updating to the latest Enfold Version, that the changes in the enfold/config-templatebuilder/avia-shortcodes/toggles/toggles.js file were overwritten by the update. Is it possible to integrate that JS file with the changes in my Child Theme directory, so I don’t have to alter the file after every Enfold update? Nevertheless, how do I know if there are important changes in that JS file within an Enfold update? It’s a dilemma if that file is integrated in my Child Theme because important updates won’t be effective. In my opinion, that issue with the sticky header covering toggles should be fixed within the original Theme code. I can’t believe that I am the only costumer struggling with that.

    Kind regards
    Ueli

    in reply to: Current menu item in secondary menu #1346609

    Hi Rikard
    You can close the topic
    Kind regards
    Ueli

    in reply to: Toggles of accordions are covered by the sticky header #1346014

    Hi Ismael

    Your last suggestion seems to work quiet well! Nevertheless, if I click from toggle to toggle, the offset seems not to be exactly the same every time. Sometimes you can slightly see the above toggle, sometimes not. See the screen video in Private Content where I point with the mouse pointer to the position which I mean. It’s not always the same if I repeat the test or reload the page. It also differs from browser to browser. Why does this happen?

    I must admit that I might be a little picky, but it would be nice if the offset is always pixel accurate, so you can’t see the above toggle. I played a little bit with the offset value but I can’t achieve perfect results.

    Kind regards
    Ueli

    in reply to: Toggles of accordions are covered by the sticky header #1345776

    Hi Ismael

    Thanks for your new approach but it’s still not really working reliably. If I click from toggle to toggle, sometimes the toggle is below the sticky header but sometimes it’s still covered. I tested on incognito mode with the latest Firefox and Chrome desktop browsers on Windows 10. Interestingly, the two browsers do not behave identically. That means the same toggle can be covered in Firefox whereas it’s visible on Chrome and vice versa. It becomes even stranger if I repeat the test several times. Toggles that have been visible are covered now. At least, it seems to work on the Safari browser with iPadOS.

    I made two screen videos with Firefox and Chrome. Please see links in Private Content.

    Kind regards
    Ueli

    in reply to: Accordion/Toggles deeplinking #1345427
    in reply to: Accordion/Toggles deeplinking #1345109

    Hi Ismael
    The confusion’s getting bigger!
    Your last post refers to the first issue I’ve mentioned in this topic. This was already solved by your post from September 23 (https://kriesi.at/support/topic/accordion-toggles-deeplinking/#post-1322006).
    Since weeks I’m talking about the second issue within this topic which I explained firstly on my post from October 15 and November 1 (https://kriesi.at/support/topic/accordion-toggles-deeplinking/#post-1327294). You provided then a solution with a PHP function (avf_header_setting_filter_mod), that doesn’t work so far. In my post from December 3, I specified the issue with a video, because your team member Mike got involved in this thread (https://kriesi.at/support/topic/accordion-toggles-deeplinking/#post-1331474).
    On March 9, you specified your solution but it hasn’t the expected impact yet. On desktop browsers, the sticky header still covers the toggles (anchor link) of the accordion. In my last post from March 13 I’ve tried to point out that your PHP function might not be reloaded or reinitialized properly if you click from toggle to toggle within the same browser window/tab. It only seems to work properly if you copy the URL of a toggle in the address bar of a new browser window/tab. Then the toggle is at the defined scroll-offset position (according to the PHP function) below the sticky header.
    I hope that it is clear now, what I mean and I really hope that there is a reliable solution very soon.
    Kind regards
    Ueli

    in reply to: Accordion/Toggles deeplinking #1344296

    Dear Enfold Support
    I’m a little frustrated that there’s still no solution to my issue https://kriesi.at/support/topic/accordion-toggles-deeplinking/#post-1331474.
    I just found out some special behavior that might help you to figure out the problem.
    See explanations in private content.
    I really appreciate if you could provide a solution as soon as possible.
    Kind regards
    Ueli

Viewing 30 posts - 1 through 30 (of 48 total)