javascript conflict
-
I am using the Sight theme and have included a javascript file in functions.php (related to a drop-down menu I added in the header) and it is causing a conflict with the scripts.js file that is already part of the theme.
When i disable script.js, my dropdown menu works but the view option feature between grid and list doesn’t work (referred to in scripts.js). When I disable jquerydropdownPlain.js (my menu script), the view option works but my drop-down menu breaks. My first thought was that the code in script.js that refers to the dropdown menu included with sight (which I do not use) was causing a conflict. However, I have not been able to figure out how to delete just that section.
Thanks in advance for any advice.
my script in functions.php
// Load jQuery if ( !is_admin() ) { wp_deregister_script('jquery'); wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"), false); wp_enqueue_script('jquery'); wp_register_script('topmenu', get_bloginfo('template_directory') . "/js/jquerydropdownPlain.js"); wp_enqueue_script('topmenu'); }
script.js included in header.php
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', 'jquery', false);
The javascript of jquerydropdownPlain.js
$(function(){ $("#dropdown li").hover(function(){ $(this).addClass("hover"); $('ul:first',this).css('visibility', 'visible'); }, function(){ $(this).removeClass("hover"); $('ul:first',this).css('visibility', 'hidden'); }); $("#dropdown li ul li:has(ul)").find("a:first").append(" » "); });
- The topic ‘javascript conflict’ is closed to new replies.