...

View Full Version : jQuery jQuery.noConflict Issue



billatl
10-31-2010, 06:13 PM
Hello,

I'm having a jQuery conflict issue I'm unclear how to resolve. The problem is I've added some jQuery vertical tab code to one of my pages that's conflicting with one of my Wordpress plugins. I realize folks may not be familiar with Wordpress, but I think my issue is less to do with the blog than a conflict with jQuery.

The plugin in question is WP-Lightbox 2. It references the WP installation (/wp-includes/js/jquery) of jQuery. The last line of that file contains "jquery.noconflict;". When I remove this line, Lightbox 2 stops working - but my vertical tab code works. Add it back and Lightbox works, but my code doesn't. I've tried "$j=jquery.noConflict;" but that doesn't work either.

So, my question is - what exactly does this line do and are there any alternatives I can use? Here's my vertical tab code:



<script type="text/javascript">
$(function() {
var $items = $('#vtab>ul>li');
$items.mouseover(function() {
$items.removeClass('selected');
$(this).addClass('selected');

var index = $items.index($(this));
$('#vtab>div').hide().eq(index).show();
}).eq(1).mouseover();
});
</script>

SB65
11-01-2010, 02:23 PM
Have a look here (http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers) for what I suspect is the issue.

billatl
11-06-2010, 07:52 PM
Awesome job, thanks that worked!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum