创建像 RDP 菜单栏一样的 jquery 下拉菜单

发布于 2024-08-26 14:28:55 字数 157 浏览 5 评论 0原文

我不太熟悉 jquery 所以我不太确定如何做到这一点。基本上,我希望一个 html 块隐藏在页面顶部,并伸出约 3px 的边缘(鼠标悬停的东西),当您将鼠标悬停在它上面时,隐藏的部分会向下滑动。

基本上我希望它像 RDP 全屏菜单栏一样工作。关于这样做的最佳方法是什么有什么想法吗?

I'm not all that familiar with jquery so I'm not quite sure how to do this. Basically, I want a block of html to stay hidden at the top of the page with a ~3px edge sticking out (something to mouseover), and when you mouse over it, the hidden section slides down.

Basically I want it to work like the RDP full screen menu bar works. Any thoughts on what the best way of doing this is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

桃扇骨 2024-09-02 14:28:55

jquery:

$("#slide").bind("mouseover", function() {
     $(this).animate({
          top: '+=189'                      
     });
}).bind("mouseout", function() {
     $(this).animate({
          top: '-=189'                      
     });
});

样式:

   <style type="text/css">
   #slide {
     background:#ccc;
     border:1px solid #000;
     width:200px;
     height:200px;
     padding:10px;
     position:absolute;
     top:-190px;
     }
  </style>

html:

<div id="slide">
test<br>
test<br>
test<br>
test
</div>

jquery:

$("#slide").bind("mouseover", function() {
     $(this).animate({
          top: '+=189'                      
     });
}).bind("mouseout", function() {
     $(this).animate({
          top: '-=189'                      
     });
});

style:

   <style type="text/css">
   #slide {
     background:#ccc;
     border:1px solid #000;
     width:200px;
     height:200px;
     padding:10px;
     position:absolute;
     top:-190px;
     }
  </style>

html:

<div id="slide">
test<br>
test<br>
test<br>
test
</div>
离去的眼神 2024-09-02 14:28:55

您应该能够在 Jquery UI

http://jqueryui.com/demos/hide/ 的帮助下完成此操作
在下拉菜单中选择幻灯片。

You should be able to do it with the help of Jquery UI

http://jqueryui.com/demos/hide/
Pick slide in the dropdown menu.

浸婚纱 2024-09-02 14:28:55

感谢您的回复。通过对上面的代码进行一些调整,我发现了上面的 .hover() 方法。上面的 javascript 看起来像

$("#slide").hover(function () {
            $(this).animate({
                top: '+=30'
            });
        }, function () {
            $(this).animate({
                top: '-=30'
            });
        });

Thanks for the responses. With a little tweaking of the above code I found out above the .hover() method. The above javascript would then look like

$("#slide").hover(function () {
            $(this).animate({
                top: '+=30'
            });
        }, function () {
            $(this).animate({
                top: '-=30'
            });
        });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文