WordPress.org

Ready to get started?Download WordPress

Forums

Post UI Tabs
[resolved] Post UI Tabs jquery conflicts solution (2 posts)

  1. hankmoody
    Member
    Posted 3 years ago #

    This is a fantastic plugin, but you may find the plugin conflicts with other plugins using jQuery, for example, Custom Contact Forms. This is because the script should really start with the statement "$j = jQuery.noConflict();" To solve this problem, replace the post-ui-tabs.js file with the following .js in its entirety. I hope users of the plugin will find this uselful - perhaps the author will replace the script with the one shown below. Remember to backup before you change it. Regards, Matthew Dannatt.

    $j = jQuery.noConflict();
    $j(document).ready(function(){
    
    	if( 'undefined' == typeof( tab_settings ) )
    		return;
    
    	var i;
    	for( i = 1; i <= tab_settings.total; i++ ) {
    		var disabled;
    		var settings = { fx: { opacity: 'toggle' } };
    
    		if( 'string' == typeof( tab_settings.use_cookies ) )
    			if( tab_settings.use_cookies )
    				settings.cookie = { expires: 30 };
    
    		if( 'undefined' != typeof( tab_settings[i] ) ) {
    			disabled = tab_settings[i].split(',');
    			var key;
    			for( key in disabled )
    				disabled[key] = parseInt( disabled[key] ) - 1;
    			settings.disabled = disabled;
    		}
    
    		$j( '#tabs-'+i ).tabs(settings);
    	}
    
    	$j( '.put-next' ).click(function() { 
    
    		var tabset = $j( 'div' + $j(this).attr('href') ).tabs(); 
    
    		if( 'undefined' == typeof( tabset ) )
    			return false;
    
    		var tabs = $j( tabset.selector + ' ul' ).children();
    		var next = tabset.tabs( "option", "selected" ) + 1;
    
    		if( 'undefined' == typeof( tabs[next] ) ){
    			if( !$j( tabset.selector + ' ul li:eq(0)' ).hasClass('ui-state-disabled') )
    				tabset.tabs( 'select', 0 );
    			return false;
    		}
    
    		while( next < tabs.length ) {
    			var next_tab_disabled = $j( tabset.selector + ' ul li:eq('+next+')' ).hasClass('ui-state-disabled');
    			if( next_tab_disabled ) {
    				next = next + 1;
    				continue;
    			}
    			tabset.tabs( 'select', next );
    			break;
    		}
    		return false;
    	});
    
    	$j( '.put-prev' ).click(function() { 
    
    		var tabset = $j( 'div' + $j(this).attr('href') ).tabs(); 
    
    		if( 'undefined' == typeof( tabset ) )
    			return false;
    
    		var tabs = $j( tabset.selector + ' ul' ).children();
    		var prev = tabset.tabs( "option", "selected" ) - 1;
    
    		if( 'undefined' == typeof( tabs[prev] ) ){
    			if( !$j( tabset.selector + ' ul li:eq('+ ( tabs.length - 1 ) +')' ).hasClass('ui-state-disabled') )
    				tabset.tabs( 'select', tabs.length - 1 );
    			return false;
    		}
    
    		while( prev >= 0 ) {
    			var prev_tab_disabled = $j( tabset.selector + ' ul li:eq('+prev+')' ).hasClass('ui-state-disabled');
    			if( prev_tab_disabled ) {
    				prev = prev - 1;
    				continue;
    			}
    			tabset.tabs( 'select', prev );
    			break;
    		}
    		return false;
    	});
    });

    http://wordpress.org/extend/plugins/put/

  2. Mark / t31os
    Moderator
    Plugin Author

    Posted 3 years ago #

    $j = jQuery.noConflict();
    $j(document).ready(function(){

    Is the same as doing..

    jQuery(document).ready(function($j){

    It should behave no differently to the current code.

    Which plugins did you find there were conflicts with, i'd like to take a look at some of them to test this problem.

    And thanks for the report.. :)

    EDIT: No further input from the poster, marking as resolved.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic