0

我想在“Bio”菜单元素上复制单击“Contact”菜单元素下拉效果

http://www.dawaf.co.uk/jj/

我在 header.php 中复制了 html 代码:

<!-- contact -->
<section id="contact">
    <!-- container -->
    <div class="container">
                <p>Creative Consultant / Stylist<br /><br /><a href="mailto:info@janinejauvel.co.uk">info@janinejauvel.co.uk</a><br />
                +44(0) 7983 572330</p>
        
    </div>
    <!-- .container -->
    
</section>
<!-- .contact -->

<!-- bio -->
<section id="bio">
    <!-- container -->
    <div class="container">
                <p>Testing this shows up</p>
        
    </div>
    <!-- .container -->
    
</section>
<!-- .bio -->

我已经复制了 CSS。

我不确定我需要编辑什么 Javascript 才能在 script.js 上获得相同的效果:

    /* Show the portfolio
     ------------------------------------------------- */
    
    $('#portfolio-catcher').click(function() {
        
        $('h1 a').trigger('click');
        
        return false;
        
    });
    
    $('a[href="#portfolio"]').click( function () {

        // hide contact 
        $('#contact').stop().slideUp({
            duration: 250, 
            easing: 'easeInOutCubic'
        });
        
        // remove the iframe content (for vimeo videos)
        
        $('iframe').remove();
        
        hattie.showPortfolio();

        return false;


    });
    
    /* Contact section click
         ------------------------------------------------- */
        $('a[href="#contact"]').click(function() {

            // hide slideshow whatever
            $('#slideshow').stop().slideUp({
                duration: 300, 
                easing: 'easeInOutCubic'
            });     

            // show contact
            $('#contact').stop().slideDown({
                duration: 300, 
                easing: 'easeInOutCubic'
            });

            hattie.showPortfolio();

            return false;

    });
    
    /* Launching a project
     ------------------------------------------------- */

    $('hgroup').click(function() {

        // scroll to top
        $.scrollTo(0, 250);

        $hgroup     = $(this);
        // hide contact 

        if ($('#contact').is(':visible')) {

            $('#contact').stop().slideUp({
                duration: 250, 
                easing: 'easeInOutCubic'
            });
        }

        // show the loading gif in the container
        $('#slideshow-container').html('<div class="loading"><img src="/assets/img/loading.gif" alt="loading"/></div>');

        $('section#work').stop().animate({
            'margin-top' : '+=' +($(window).height() - 55) + 'px'
        }, 700, 'easeInOutCubic', function () {

            // load the project into the slideshow container div
            $('#slideshow-container').load('' + $hgroup.attr('data-project'), function() {
                // bind slideshow
                    slideshow.render();
                    $('section#work').css('margin-top', '0px');
            });

        });

        return false;

    });
    
}, 

this.folioLinkShow  = function() {
    
    if ($('.slide').length > 1) {
        
        
        $('#portfolio-catcher').hover(function() {

            $('nav#show-projects div').slideDown(200);


        }, function () {

            $('nav#show-projects div').slideUp(200);

        });
        
        
    } else {
        
        $('nav#show-projects').unbind();
        
    }
}, 

this.loadImages     = function() {
4

1 回答 1

0

使您的“生物”href 像这样:#bio

然后,将其添加到您的 Javascript 中(它的作用与点击联系人的作用完全相同:

/* Contact section click ------------------------------------------------- */
$('a[href="#contact"]').click(function() {
    // hide bio
    if ($('#bio').is(':visible')) {
        $('#bio').stop().slideUp({
            duration: 250, 
            easing: 'easeInOutCubic'
        });
    }
    // hide slideshow whatever

        $('#slideshow').stop().slideUp({
            duration: 300, 
            easing: 'easeInOutCubic'
        });     

        // show contact
        $('#contact').stop().slideDown({
            duration: 300, 
            easing: 'easeInOutCubic'
        });

        hattie.showPortfolio();

        return false;

});

/* Bio section click ------------------------------------------------- */
$('a[href="#bio"]').click(function() {
    // hide contact 
    if ($('#contact').is(':visible')) {
        $('#contact').stop().slideUp({
            duration: 250, 
            easing: 'easeInOutCubic'
        });
    }

    // hide slideshow whatever
    $('#slideshow').stop().slideUp({
        duration: 300, 
        easing: 'easeInOutCubic'
    });     

    // show contact
    $('#bio').stop().slideDown({
        duration: 300, 
        easing: 'easeInOutCubic'
    });

    hattie.showPortfolio();

    return false;

});
于 2012-08-14T19:54:55.993 回答