Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jQuery Newbie Needs Help!
Old 06-26-2009, 08:27 PM jQuery Newbie Needs Help!
Junior Talker

Posts: 1
Trades: 0
Hey guys,

I'm learning jQuery/JavaScript for the first time and putting together an online calling card in the style of Tim Van Damme as my sandbox for it. I'm almost there, but am having a problem I can't exactly pinpoint.

The files in question:
  1. http://willphillips.org/files/test/
  2. http://willphillips.org/files/test/temp-style.css
  3. http://willphillips.org/files/test/scripts/jquery.js
  4. http://willphillips.org/files/test/scripts/jquery.ui.js
  5. http://willphillips.org/files/test/s...wp-switcher.js
The problem:

Notice the links in the masthead (Work Play) - when you click them from the first pane (Hello...), everything loads and dissapears just fine.

However, when you click on these links from the other two panes, the dissapearing pane gets pushed down below the masthead for a second or two (by virtue of the new pane's display attribute / class swapping) before disapearing. This pushes the whole footer/contact area down.

Obviously, that's not gonna work.


The code:

Here's a copy of my wp-switcher.js code. To all your jQuery and JavaScript pros, it's probably really nasty looking. I'll be the first to admit that I frankensteined the bits and pieces together and started hacking away until things miraculously started working.

Because I'm a noob, I'm not even sure why what I did was wrong, much less how to remedy it!

Code:
    $(document).ready(function() {  
    
        //Main Hello Tab Controls
        $('a#link-hello-work').click(function() {  
        $('#tab-hello').fadeOut("1000").addClass("ui-tabs-hide")
            $('#tab-work').fadeIn("1500").removeClass("ui-tabs-hide")
            }); 
        
        $('a#link-hello-play').click(function() {  
        $('#tab-hello').fadeOut("slow").addClass("ui-tabs-hide")
            $('#tab-play').fadeIn("slow").removeClass("ui-tabs-hide")
            }); 

        //Work Tab Controls
        $('a#link-work-hello').click(function() {  
        $('#tab-work').fadeOut("slow").addClass("ui-tabs-hide")
            $('#tab-hello').fadeIn("slow").removeClass("ui-tabs-hide")
            }); 
        
        $('a#link-work-play').click(function() {  
        $('#tab-work').fadeOut("slow").addClass("ui-tabs-hide")
            $('#tab-play').fadeIn("slow").removeClass("ui-tabs-hide")
            }); 
            
        //Play Tab Controls
        $('a#link-play-hello').click(function() {  
        $('#tab-play').fadeOut("slow").addClass("ui-tabs-hide")
            $('#tab-hello').fadeIn("slow").removeClass("ui-tabs-hide")
            }); 
        
        $('a#link-play-work').click(function() {  
        $('#tab-play').fadeOut("slow").addClass("ui-tabs-hide")
            $('#tab-work').fadeIn("slow").removeClass("ui-tabs-hide")
            }); 
    });
Will Phillips is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2009, 08:11 PM Re: jQuery Newbie Needs Help!
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
In order to fade from one to another, both will need to be absolutely positioned in the same place. Otherwise, the natural order of the CSS rules will take over as each item is slowly faded in then hidden, and visa versa.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to jQuery Newbie Needs Help!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11502 seconds with 12 queries