0

我有一个 wordpress 网站,那里有菜单。我想要的是,当一些身体悬停在 SITE 徽标上时,它会显示下拉菜单....我想要做的是始终打开,不仅在我点击时。它必须在页面刷新时加载,

任何机构都可以告诉如何做到这一点?

4

2 回答 2

2

用于$(document).ready(function() {}在页面加载后运行代码。然后,您可以使用 JQuery delay() 函数等待 3 秒,然后再调用菜单对象上的 slideDown。像这样的东西会起作用:

$(document).ready(function() {
    $('#yourMenuID').delay(3000).slideDown(300);
}

http://api.jquery.com/delay/

于 2012-06-12T13:40:13.760 回答
0

.ready() - 使用它来确保被引用的对象处于就绪状态。

文档 - http://api.jquery.com/ready/

css() - 使用它来修改属性的 CSS 值

文档:http ://api.jquery.com/css/

代码示例

//only execute when the document returns ready
//this can be trivial if your putting the code at the footer
//you may wish to use a self invoking function in that case
$(document).ready(function(){
  setTimeout(function(){
    //do something
    $('#somethingcool').css('background-color', 'red');

  //3 seconds = 3000ms
  }, 3000);
});

于 2012-06-12T13:37:12.507 回答