Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #278586

    Hello
    I do not use Enfold builtin menu but another plugin (shitnav pro).
    In one of my page I use the toggle panes
    But I got an javascript error when I try to use open the Shiftnav Pro menu

    Erreur : TypeError: $(…).attr(…) is undefined
    Fichier Source : /wp-content/themes/enfold/js/shortcodes.js
    Ligne : 2291 > var hash = $(this).attr(‘href’).replace(/^.*?#/,”);

    Thanks

    #278851
    This reply has been marked as private.
    #278856

    Hi!

    Tbh I think this is a plugin bug. The author uses an anchor element without href attribute (which is essential for the anchor) and the missing href value breaks our code. I recommend to contact the author and to ask him to use another element like a span, div or p tag or to add href=”#” to the anchor element. If you want to modify the theme files instead open up wp-content/themes/enfold/js/shortcodes.js and replace:

    
                		var hash = $(this).attr('href').replace(/^.*?#/,'');
                		if(hash) trigger_default_open('#'+hash););
    

    with

    
                var hash = $(this).attr('href');
                if(typeof hash != "undefined" && hash)
                {
                    hash = hash.replace(/^.*?#/,'');
                    trigger_default_open('#'+hash);
                }
    

    Regards,
    Peter

    #278873
    This reply has been marked as private.
    #278883

    Hey!

    I tagged the thread for the other support staff members. I can’t test the website with an ipad/iphone and I asked them to test it.

    Best regards,
    Peter

    #278928

    Hey!

    Try adding this code to the Quick CSS:

    .avia_mobile #top .av-section-video-bg {
        z-index: 10 !important;
    }
    .avia_mobile #top .av-section-video-bg:after{
        z-index: -1 !important;
    }
    

    Cheers! 
    Josue

    #278936

    Hello Josue
    Added your CSS, now I can touch the Youtube play button but the video do not start : I’ve got a black screen instead… :-(

    #278998

    Yes i noted that too. To be honest i think it would be better to set a fallback image, background video playback in mobiles is buggy right now.

    Best regards,
    Josue

    #279071

    Hello
    1- For the first issue (Javascript conflict with function trigger_default_open()), here is the plugin autho response:

    ——
    No, anchors do not require href attributes since HTML5, and it is not essential. The ShiftNav toggle code is perfectly valid.
    Reference: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a

    href – This was the single required attribute for anchors defining a hypertext source link, but is no longer required in HTML5.

    ShiftNav does not break your theme code – your theme code throws an error because it is making assumptions about the elements on the page. This wouldn’t be a problem if it were only dealing with its own elements, but it is binding events to elements that it hasn’t produced, meaning it isn’t controlling the attributes. The theme code should not be assuming that an href is present, when it is not required.

    I read through your post in the Kriesi forum. Then I looked at the theme code in /wp-content/themes/enfold/js/shortcodes.js

    I think this code:

    [js]
    $('a').on('click',function(){
    var hash = $(this).attr('href').replace(/^.*?#/,'');
    if(hash) trigger_default_open('#'+hash);
    });
    [/js]

    should just be written like this:

    [js]
    $('a[href]').on('click',function(){
    var hash = $(this).attr('href').replace(/^.*?#/,'');
    if(hash) trigger_default_open('#'+hash);
    });
    [/js]
    

    That way it only attaches to anchors with href elements, and in the callback you can be sure the href exists. The solution is simple and efficient, and there’s no need to bind the callback to any anchor without an href.
    ——
    So to make it work I replace the A tag of my ShiftNav Menu by a SPAN, this is a workaround, and maybe you could tell to Kriesi about that… ?

    2/ “To be honest i think it would be better to set a fallback image, background video playback in mobiles is buggy right now.
    Should be great to also tell to Kriesi about that issue, don’t you think ?

    #279122

    Hey!

    1) We’ll include the patch I posted here: https://kriesi.at/support/topic/javascript-conflict-with-function-trigger_default_open/#post-278856 with the next update. I already sent the patch to Kriesi.

    2) Kriesi is already aware of it. Unfortunately this limitation does not affect all devices and there’s no perfect solution at the moment. I.e. Android mobile phones will play the video just fine.

    Best regards,
    Peter

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.