0

In my project I have hamburger menu to show up the menu list for Ecommerce site. But I have tried in normal php site it works fine, but I am confused where to put the javascript code in Magento site. I am using the magento version 1.9.3

enter image description here

Even I tried this code in layout.xml

<action method="addItem"><type>skin_js</type><name>js/nav.js</name><params/></action>

Can anyone help me. Thank you in advance.

3

if you don't want it to be merged with other magento scripts you can add Javascript to

System > Configuration > Design > Html Head > Miscellaneous Scripts

or

System > Configuration > Design > Footer > Miscellaneous HTML

no need to bother with layout files if you don't want to

enter image description here

  • It didn't work for me has per the answer. – Ritu Dec 14 '16 at 18:35
  • Sorry your answer works for me. I forgot to clear up the cache. – Ritu Dec 14 '16 at 18:54
0

Add below code to your layout.xml file.

<default>
   <reference name="head">
      <action method="addItem"><type>skin_js</type><name>js/script_name.js</name></action>
   </reference>
</default>

script_name.js file located :

skin/frontend/{Theme Package Name}/{Theme Name}/js/script_name.js

  • I tried this method but it didn't display it – Ritu Dec 14 '16 at 18:35
  • Add your layout xml code or js path. above code is working and tested. – Suresh Chikani Dec 15 '16 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.