Git Product home page Git Product logo

homepage's People

Contributors

noisky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

homepage's Issues

继mobile端添加点击下拉菜单以外区域收起菜单修复一处bug优化冗余

经测试,代码做如下优化,并去除一个点击空白处菜单出现复弹的情况

function bounceOutUp() {
    $('.navigation-wrapper').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
        $('.navigation-wrapper').toggleClass('visible animated bounceOutUp');
        $('.navigation-wrapper').off('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
    });
    $('.navigation-wrapper').toggleClass('animated bounceInDown animated bounceOutUp');
}

$('.btn-mobile-menu').click(function() {
    if ($(".navigation-wrapper").hasClass("bounceInDown")) {
        bounceOutUp();
    } else {
        $('.navigation-wrapper').toggleClass('visible animated bounceInDown');
    }
    $('.btn-mobile-menu__icon').toggleClass('fa fa-list fa fa-angle-up animated fadeIn');
});

// 点击下拉菜单以外的其他标签区域收起菜单生效
$(".panel-main").on('click', ':not(.mobile,.btn-mobile-menu,.navigation-wrapper)', function(e) {
    if ($(".navigation-wrapper").hasClass("bounceInDown")) {
        bounceOutUp();
        $('.btn-mobile-menu__icon').toggleClass('fa fa-list fa fa-angle-up animated fadeIn');
    }
});
// 阻止冒泡事件执行
$(".navigation-wrapper").click(function(event) {
    event.stopPropagation();
});

mobile端添加点击下拉菜单以外区域收起菜单

mobile端添加点击下拉菜单以外区域收起菜单

$('.btn-mobile-menu__icon').click(function() {

   $('.btn-mobile-menu').click(function() {
        if ($('.navigation-wrapper').css('display') == "block") {
            $('.navigation-wrapper').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
                $('.navigation-wrapper').toggleClass('visible animated bounceOutUp');
                $('.navigation-wrapper').off('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
            });
            $('.navigation-wrapper').toggleClass('animated bounceInDown animated bounceOutUp');
        } else {
            $('.navigation-wrapper').toggleClass('visible animated bounceInDown');
        }
        $('.btn-mobile-menu__icon').toggleClass('fa fa-list fa fa-angle-up animated fadeIn');
    });

    // 判断是否为移动端
    var isMobile = navigator.userAgent.toLowerCase().match(/(ipod|iphone|android|coolpad|mmp|smartphone|midp|wap|xoom|symbian|j2me|blackberry|wince)/i) != null;

    // 点击下拉菜单以外的其他标签区域收起菜单生效
    $(document).on('click', ':not(.mobile,.navigation-wrapper,.btn-mobile-menu,.btn-mobile-menu__icon,panel-main__content)', function(e) {
        if ($('.navigation-wrapper').css('display') == "block" && isMobile) {
            $('.navigation-wrapper').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
                $('.navigation-wrapper').toggleClass('visible animated bounceOutUp');
                $('.navigation-wrapper').off('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
            });
            $('.navigation-wrapper').toggleClass('animated bounceInDown animated bounceOutUp');
            $('.btn-mobile-menu__icon').toggleClass('fa fa-list fa fa-angle-up animated fadeIn');
        }
    });

    // 点击下拉菜单以外的空白区域收起菜单生效
    $(".panel-cover").on('click', ':not(.navigation-wrapper)', function(e) {
        if ($('.navigation-wrapper').css('display') == "block" && isMobile) {
            $('.navigation-wrapper').on('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
                $('.navigation-wrapper').toggleClass('visible animated bounceOutUp');
                $('.navigation-wrapper').off('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend');
            });
            $('.navigation-wrapper').toggleClass('animated bounceInDown animated bounceOutUp');
            $('.btn-mobile-menu__icon').toggleClass('fa fa-list fa fa-angle-up animated fadeIn');
        }
    });
    // 阻止冒泡事件执行
    $(".navigation-wrapper").click(function(event) {
        event.stopPropagation();
    });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.