-
AuthorPosts
-
June 13, 2014 at 1:02 pm #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 menuErreur : TypeError: $(…).attr(…) is undefined
Fichier Source : /wp-content/themes/enfold/js/shortcodes.js
Ligne : 2291 > var hash = $(this).attr(‘href’).replace(/^.*?#/,”);Thanks
June 14, 2014 at 9:45 am #278851This reply has been marked as private.June 14, 2014 at 10:47 am #278856Hi!
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,
PeterJune 14, 2014 at 2:30 pm #278873This reply has been marked as private.June 14, 2014 at 3:23 pm #278883Hey!
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,
PeterJune 14, 2014 at 6:48 pm #278928Hey!
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!
JosueJune 14, 2014 at 7:14 pm #278936Hello 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… :-(June 14, 2014 at 11:43 pm #278998Yes 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,
JosueJune 15, 2014 at 11:09 am #279071Hello
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/ahref – 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 ?June 15, 2014 at 4:57 pm #279122Hey!
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 -
AuthorPosts
- You must be logged in to reply to this topic.