News:

Support the VirtueMart project and become a member

Main Menu

[ SOLVED ] jQuery problems VirtueMart 2.0.18a / Joomla 2.5.8 - updated!!!

Started by carmbo, February 18, 2013, 16:24:52 PM

Previous topic - Next topic

carmbo

I'm using VM 2.0.18a in Joomla 2.5 at http://cardsports.cloudaccess.net/
I'm using jQuery toggle to show/hide the submenu of the main menu at the top. The code is:
        $('.deeper ul').hide();
   $('.deeper ul').click(function(event){
   // console.log('click - submenu');
   //we want all click events in the submenu to stop at the submenu container element, so that the event does not reach the body element
   event.stopPropagation();
   });
   $('html').click(function(event){
   if ($(".deeper ul").css('display') == 'block') {     
   //console.log('click - body');
   //hide the submenu if the body is clicked
   $('.deeper ul').hide();
   }
   })
   $('.deeper>a').click(function(event){
   $('.deeper ul').toggle();
   event.stopPropagation();
   })
It works on the Home page but does not work on any of the VM generated pages,
such as if you click the search button or go to one of the product category pages
by clicking one of the submenu items under Collectables.
I've already got VM set not to load jQuery and have got jQuery Easy running too.

***I just figured out that if I put the script directly inside the index.php file it will work on the VM pages.
So I guess I solved my problem...but would love to know why this script wasn't executing when it was included
from an external file. Anyone have any ideas?

Thanks.

jenkinhill

Often it is related to the order in which the js files are listed and read in the document head,
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum