Search code examples
jquerycoda-slider

fadeOut element when jquery slideshow is on #1


The site in question: http://notlaura.com/dev/smfa/index-all2.php

I want the 'back to list' button (#to-list) only to appear when the first panel of the Coda Slider is hidden. This works until the first panel is encountered with the arrow navigation. My code is:

    $("#to-list").hide();

    $("li.name,a#nl").click(function(event){        
        $("#to-list").fadeIn(900);
    }); 

    $("#to-list").click(function(event){
        $("#to-list").fadeOut(900);
    });

I tried checking for $('a[href$="#1"]') but the arrow hrefs are only #, so that doesn't work. Also tried a conditional for the URL with window.location, and checking if the panel is hidden, if( $("#list").is(":visible") ) {}

But no success. Any help is greatly appreciated - thanks in advance!


Solution

  • You could try window.location.hash

    $("li.name,a#nl").click(function(event){
        if(window.location.hash == "#1") {
            $("#to-list").fadeOut(900);
        } else {
            $("#to-list").fadeIn(900);
        }
    });