jquery slideout help not working with newer versions of jquery....

Discussion in 'JavaScript' started by dpsim, Oct 23, 2010.

  1. #1
    hi, i have a jquery problem...

    this script is not working with jquery-1.4.2.min, but it works with jquery-1.2.6.min.js, can anyone help me???the script is the above:
    (it is not working the tab actions, the slideout works...)

    the javascript code is the above:
    
    var jqsideTabs;
    var tabs, h = 50, r = 0,ra = 0;
    $(document)
    .ready(function(){
        jqsideTabs = $('#sideTabs').addClass('closed');
        
        tabs = jqsideTabs
        .find('.tab h3')
        .clone()
        .appendTo(jqsideTabs)
        .each(function(i){
            var that = $(this), cls = '',ow,newThis, newEl;
            
            if( i == 0 ) cls = ' active';
            newEl = $('<a href="#" class="tabLinks'+cls+'">' + that.text() + '</a>');
            that.replaceWith(newEl);
            
            ow = newEl.outerWidth();
            
            if( i == 0 ) ra = ow;
            else r = ow;
            
            h = newEl.css({'top':h , 'right': -ow }).height() + h;
            
            newThis = newEl.get(0);
            newThis.jq = newEl;
            newThis.i = i;
            
            newEl.click(function(){
                var el = this.jq;
                
                if( jqsideTabs.hasClass( 'closed' ) ){
                    jqsideTabs.removeClass('closed');
                }
                else if( !jqsideTabs.hasClass( 'closed' ) && el.hasClass('active') ){
                    jqsideTabs.addClass('closed');
                }
                
                el
                .siblings()
                    .removeClass('active')
                    .css({'right': -r })
                .end()
                .addClass('active')
                .css({'right': -ra });
                
                tabs.eq( this.i ).show().siblings('.tab').hide();
                
                return false;
            });
        })
        .end()
        .parent()
            .eq(0)
            .addClass('active')
        .end()
            .filter(':not(:eq(0))')
            .hide()
        .end();
        
        jqsideTabs.bind("mouseleave",function(){
            jqsideTabs
            .animate({left:-310}, 'fast', function(){
                jqsideTabs.addClass('closed').removeAttr('style');
            });
        });
    }); 
    
    PHP:
    and the html file is:
    
    <div id="sideTabs">
    
    	<div class="tab">
        	<h3>Tab 1</h3>
            <div class="gut">
            	<p>Some text</p>
            </div>
        </div>
    	<div class="tab">
        	<h3>Tab 2</h3>
    
            <div class="gut">
            	<ul>
                	<li>link</li>
                </ul>
            </div>
        </div>
    	<div class="tab">
        	<h3>Tab 3</h3>
    
            <div class="gut">
            	<ul>
                	<li>link</li>
                </ul>
            </div>
        </div>
    </div>
    
    HTML:
    the problem is that the tab button works, but the content doesnt change...in all of tabs showing the same text(showing all tbas content)....

    can anyone help...please.....
     
    dpsim, Oct 23, 2010 IP
  2. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I found that it works for 1.3.1 but not 1.3.2.

    Looking at the 1.3.2 release notes, they made changes to the way elements were selected, and also to the way that appendTo() works.

    Unfortunately, I can't spot the problem so maybe someone else can add to that.
     
    Cash Nebula, Oct 23, 2010 IP