Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    simple fade effect problem!?

    Hi,
    this is my first jQuery try - I tried a simple content fade in fade out effect for my Joomla Template.

    heres some code:

    PHP Code:
    $(function() {

        var 
    newHash      "",
            
    $mainContent = $("#main-content"),
            
    $pageWrap    = $("#wrapper"),
            
    baseHeight   0,
            
    $el;
            
        
    $pageWrap.height($pageWrap.height());
        
    baseHeight $pageWrap.height() - $mainContent.height();
        
        $(
    "nav").delegate("a""click", function() { 
    window.location.hash = $(this).attr("href");
    PHP Code:
            return false;
        });
        
        $(
    window).bind('hashchange', function(){
        
            
    newHash window.location.hash.substring(1);
            
            if (
    newHash) {
                
    $mainContent
                    
    .find("#guts")
                    .
    fadeOut(200, function() {
                        
    $mainContent.hide().load(newHash " #guts", function() {
                            
    $mainContent.fadeIn(200, function() {
                                
    $pageWrap.animate({
                                    
    heightbaseHeight $mainContent.height() + "px"
                                
    });
                            });
                            $(
    "nav a").removeClass("current");
                            $(
    "nav a[href="+newHash+"]").addClass("current");
                            
                        });
                    });
            };
            
        });
        
        $(
    window).trigger('hashchange');

    }); 



    the script works but the problem is that after I click in my navigation I get a link like:

    mypage.com/workspace/joomla/#/workspace/joomla/news

    And I want:
    mypage.com/workspace/joomla/news

    so I tried to change the window location to:
    window.location.hash = $(this).attr('href').substr(0,$(this).lastIndexOf('/') + 1);

    that works but - now the effect don't work!??

    hope someone can help me out with that - thanks!
    Last edited by freshUser; 10-07-2010 at 02:57 AM.

  • #2
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Change back to what you originally had to start off with, the one where you didn't want it to link. Now create a php file named index. Place this coding in the file:
    PHP Code:
    <?php
        Header 
    'Location:http://mypage.com/workspace/joomla/news/' );
    ?>
    Probably the most simplest way since you haven't posted all the coding.

  • #3
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Hi,
    thanks but that don't really helps because - everything works, it's not linked to the wrong address - the js just creates the wrong url in the browser. If I move back to the start page - I get this url:

    mypage.com/workspace/joomla/#http://mypage.com/workspace/joomla/



    so - if I use this:

    PHP Code:
    window.location.hash = $(this).attr('href').substr(0,$(this).lastIndexOf('/') + 1); 
    the urls are like how I want them - but then the jquery effect don't works - !?

    any other ideas??

    thanks
    Last edited by freshUser; 10-07-2010 at 04:12 AM.

  • #4
    New to the CF scene
    Join Date
    Oct 2010
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    ..can't find my mistake - if someone has an idea that would be nice.. thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •