Hi,
I’m trying to link a menu-item to a script but it doesn’t seem to work. Besides that if the link is outside the avia menu it works properly.
This is my link in avia:
<li id=”menu-item-848″ class=”menu-item menu-item-type-gs_sim menu-item-object-gs_sim menu-item-top-level menu-item-top-level-6″>PEDIR ONLINE
This is my script:
<script type=”text/javascript”>
var _pyw = {
_chain: ‘kanu-sushi’,
_type: ‘online’,
_country: ‘ar’,
_linkID: [‘menu-item-847’]
};
(function() {var py = document.createElement(‘script’); py.type = ‘text/javascript’; py.async = true;py.src = ‘http://www.pedidosya.com/widget/js/py.min.js?’ + new Date().getTime();var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(py, s);})();
</script>
Thanks!
Hey,
If you say it works elsewhere one thing you could do is use the link outside the menu and have the menu trigger it, with something like:
<script>
(function($){
$(window).load(function() {
$('#menu-item-847').on('click', function(){ $('#link_that_works').trigger('click'); });
});
})(jQuery);
</script>
Best regards,
Josue
thanks!
You are welcome, glad to help :)
Regards,
Josue