gpt4 book ai didi

html - 在其
  • 子元素中也观察到悬停在
      上的反弹效果
  • 转载 作者:可可西里 更新时间:2023-11-01 14:53:33 26 4
    gpt4 key购买 nike

    好吧,在承受了很大的压力和喝咖啡之后,我使用这段代码通过将鼠标悬停在链接上来显示对子元素的弹跳效果。在将鼠标移离链接时,子元素会在延迟 4 秒后隐藏。之所以引入这个 4 秒的延迟,是因为在将鼠标悬停在链接上之后,人们往往会立即将鼠标悬停在下拉菜单上,并且由于弹跳效果,在和

  • 元素之间以及当您将鼠标悬停时,会产生间隙在间隙上方,掉落的菜单消失了,因此网站上的访问者不会知道他们必须等待弹跳停止以悬停在菜单上,所以我引入了 4 秒的延迟。现在的问题是,当我立即尝试在下拉菜单上移动鼠标时,反弹效果会在子元素上自行复制,我的意思是反弹效果会发生两次,这只会发生在立即将鼠标悬停在下拉菜单上特别是试图悬停在菜单中的第一个选项上。所以这看起来很难看,同时显示出糟糕的编码,有没有办法阻止这种情况发生。而且我还想知道有没有办法使用 jQuery 切换可见性,我不能使用显示选项,我也不能使用 removeClass 函数。我知道,这听起来可能没有什么严格的标准,但为了保持其余代码的流畅性,我需要处理以上两件事。 DEMO

    HTML 代码:

    <div id="menu">
    <ul class="menu" id="tempMenu">
    <li class="listOfNumbers">
    <a id="Menus" href="">Numbers</a>
    <ul class="submenu">
    <li>
    <a id="one" href="">one</a>
    </li>
    <li>
    <a id="two" href="">two</a>
    </li>
    <li>
    <a id="three" href="">three</a>
    </li>
    <li>
    <a id="four" href="">four</a>
    </li>
    <li>
    <a id="five" href="">five</a>
    </li>
    <li>
    <a id="six" href="">six</a>
    </li>
    <li>
    <a id="seven" href="">seven</a>
    </li>
    <li>
    <a id="eight" href="">eight</a>
    </li>
    </ul>
    </li>
    </ul>
    </div>​

    CSS 代码

    ul { margin:0; padding:0; width:0; }

    ul li {
    height: 30px;
    line-height: 30px;
    list-style: none;
    }

    ul.menu li a {

    padding:0;
    width:90px;
    display:block;

    color: #fff;
    font-size: 12px;
    font-weight: bolder;
    text-shadow: #000 0 -1px 1px;
    text-decoration: none;
    text-align: center;

    border-top: 1px solid #666;
    border-left: 1px solid #666;
    border-right: 1px solid #000;
    border-bottom: 1px solid #000;

    box-shadow: white 7px 5px 20px; /* W3 Standarts */
    -o-box-shadow: white 7px 5px 20px; /* Opera */
    -ms-box-shadow: white 7px 5px 20px; /* IE 10+ */
    -moz-box-shadow: white 7px 5px 20px; /* Firefox */
    -webkit-box-shadow:white 7px 5px 20px; /* Webkit */

    transition: text-shadow .7s ease-out,
    background .7s ease-out; /* W3 Standarts */
    -o-transition: text-shadow .7s ease-out,
    background .7s ease-out; /* Opera */
    -ms-transition: text-shadow .7s ease-out,
    background .7s ease-out; /* IE 10+ */
    -moz-transition: text-shadow .7s ease-out,
    background .7s ease-out; /* Firefox */
    -webkit-transition: text-shadow .7s ease-out,
    background .7s ease-out; /* Webkit */
    background: linear-gradient(to bottom, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(102,102,102,1) 25%,rgba(71,71,71,1) 39%,rgba(17,17,17,1) 60%,rgba(0,0,0,1) 77%,rgba(19,19,19,1) 91%);

    background: -moz-linear-gradient(top, rgba(76,76,76,1) 0%, rgba(89,89,89,1) 12%, rgba(102,102,102,1) 25%, rgba(71,71,71,1) 39%, rgba(17,17,17,1) 60%, rgba(0,0,0,1) 77%, rgba(19,19,19,1) 91%);
    /* Webkit */
    background: #666 -webkit-gradient( linear, left bottom, left top, color-stop(0.3, rgb(00,00,00)), color-stop(0.9, rgb(80,80,80)) );
    /* Opera */
    background: #666 -o-gradient( linear, left bottom, left top, color-stop(0.3, rgb(00,00,00)), color-stop(0.9, rgb(80,80,80)) );
    /* IE 10+ */
    background: -ms-linear-gradient(top, rgba(76,76,76,1) 0%,rgba(89,89,89,1) 12%,rgba(102,102,102,1) 25%,rgba(71,71,71,1) 39%,rgba(17,17,17,1) 60%,rgba(0,0,0,1) 77%,rgba(19,19,19,1) 91%);
    /* IE6-9 */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#4c4c4c', endColorstr='#131313',GradientType=0 );
    }
    ul.menu .listOfNumbers {
    margin:15px 0 0 20px;
    }
    ul.menu li .submenu {
    top:30px;
    visibility:hidden;
    }
    ul.menu li:hover .submenu {
    visibility:visible;
    animation:mymove 1.2s linear; /* W3 Standart */
    -o-animation:mymove 1.2s linear; /* Opera */
    -ms-animation:mymove 1.2s linear; /* IE 10+ */
    -moz-animation:mymove 1.2s linear; /* Firefox */
    -webkit-animation:mymove 1.2s linear; /* Safari and Chrome */
    }
    ul.menu li:not(:hover) .submenu {
    top:30px;
    opacity:0;
    transition:opacity 1.2s linear 3s,
    visibility 1.2s linear 3s; /* W3 Standart */
    -o-transition:opacity 1.2s linear 3s,
    visibility 1.2s linear 3s; /* Opera */
    -ms-transition:opacity 1.2s linear 3s,
    visibility 1.2s linear 3s; /* IE 10+ */
    -moz-transition:opacity 1.2s linear 3s,
    visibility 1.2s linear 3s; /* Firefox */
    -webkit-transition:opacity 1.2s linear 3s,
    visibility 1.2s linear 3s; /* Safari and Chrome */
    }
    @keyframes mymove
    {
    0% {opacity:0.1;margin-top:0px;}
    10% {opacity:0.3;margin-top:25px;}
    30% {opacity:0.4;margin-top:50px;}
    60% {opacity:0.5;margin-top:25px;}
    80% {opacity:0.7;margin-top:50px;}
    90% {opacity:0.9;margin-top:35px;}
    95% {opacity:0.95;margin-top:25px;}
    100% {opacity:1;margin-top:0px;}
    }
    /* Opera */
    @-o-keyframes mymove
    {
    0% {opacity:0.1;margin-top:0px;}
    10% {opacity:0.3;margin-top:25px;}
    30% {opacity:0.4;margin-top:50px;}
    60% {opacity:0.5;margin-top:25px;}
    80% {opacity:0.7;margin-top:50px;}
    90% {opacity:0.9;margin-top:35px;}
    95% {opacity:0.95;margin-top:25px;}
    100% {opacity:1;margin-top:0px;}
    }
    /* IE 10+ */
    @-ms-keyframes mymove
    {
    0% {opacity:0.1;margin-top:0px;}
    10% {opacity:0.3;margin-top:25px;}
    30% {opacity:0.4;margin-top:50px;}
    60% {opacity:0.5;margin-top:25px;}
    80% {opacity:0.7;margin-top:50px;}
    90% {opacity:0.9;margin-top:35px;}
    95% {opacity:0.95;margin-top:25px;}
    100% {opacity:1;margin-top:0px;}
    }
    /* Firefox */
    @-moz-keyframes mymove
    {
    0% {opacity:0.1;margin-top:0px;}
    10% {opacity:0.3;margin-top:25px;}
    30% {opacity:0.4;margin-top:50px;}
    60% {opacity:0.5;margin-top:25px;}
    80% {opacity:0.7;margin-top:50px;}
    90% {opacity:0.9;margin-top:35px;}
    95% {opacity:0.95;margin-top:25px;}
    100% {opacity:1;margin-top:0px;}
    }
    /* Safari and Chrome */
    @-webkit-keyframes mymove
    {
    0% {opacity:0.1;margin-top:0px;}
    10% {opacity:0.3;margin-top:25px;}
    30% {opacity:0.4;margin-top:50px;}
    60% {opacity:0.5;margin-top:25px;}
    80% {opacity:0.7;margin-top:50px;}
    90% {opacity:0.9;margin-top:35px;}
    95% {opacity:0.95;margin-top:25px;}
    100% {opacity:1;margin-top:0px;}
    }
    ul.menu .submenu li a {
    -webkit-border-top-left-radius:0px;
    -webkit-border-bottom-left-radius:0px;
    -webkit-border-top-right-radius:0px;
    -webkit-border-bottom-right-radius:0px;
    -moz-border-top-left-radius: 0px;
    -moz-border-radius-bottomleft:0px;
    -moz-border-top-right-radius: 0px;
    -moz-border-radius-bottomright: 0px;
    /* margin: 68px 95px; */
    z-index: 1000;
    }

    ul.menu .submenu li:first-child a {
    -webkit-border-top-left-radius:10px;
    -webkit-border-bottom-left-radius:2px;
    -webkit-border-top-right-radius:10px;
    -webkit-border-bottom-right-radius:2px;
    -moz-border-top-left-radius: 10px;
    -moz-border-radius-bottomleft:2px;
    -moz-border-top-right-radius: 10px;
    -moz-border-radius-bottomright: 2px;
    border-top-left-radius: 10px;
    border-bottom-left-radius:2px;
    border-top-right-radius: 10px;
    border-bottom-right-radius:2px;
    /* margin: 34px 95px; */
    z-index: 1000;
    }

    ul.menu .submenu li:last-child a {
    -webkit-border-top-left-radius:2px;
    -webkit-border-bottom-left-radius:10px;
    -webkit-border-top-right-radius:2px;
    -webkit-border-bottom-right-radius:10px;
    -moz-border-top-left-radius: 2px;
    -moz-border-radius-bottomleft:10px;
    -moz-border-top-right-radius: 2px;
    -moz-border-radius-bottomright: 10px;
    border-top-left-radius: 2px;
    border-bottom-left-radius:10px;
    border-top-right-radius: 2px;
    border-bottom-right-radius:10px;
    /* margin:260px 95px; */
    z-index: 1000;
    }


  • 最佳答案

    如何为父级设置动画 - 类似于:

    ul.menu > li:hover  {
    visibility:visible;
    animation:parentmove 1.2s linear; /* W3 Standart */
    -moz-animation:parentmove 1.2s linear; /* Firefox */
    -webkit-animation:parentmove 1.2s linear; /* Safari and Chrome */
    }

    @keyframes parentmove
    {
    0% {padding-bottom:5px;}
    10% {padding-bottom:30px;}
    30% {padding-bottom:55px;}
    60% {padding-bottom:30px;}
    80% {padding-bottom:55px;}
    90% {padding-bottom:40px;}
    95% {padding-bottom:30px;}
    100% {padding-bottom:5px;}
    }

    http://jsfiddle.net/kGqRM/187/

    填充以与子菜单移动相同的速率添加到父级的底部

    不幸的是,这意味着 li 必须是一个 block 元素并向左浮动(以便该元素实际上正确呈现 - 如果您当前检查您的 li 它似乎全部向左挤压,这就是您离开它的原因当你试图去到 child 身上时)

    关于html - 在其 <li> 子元素中也观察到悬停在 <ul> 上的反弹效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14138715/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com