用于使图层在窗口加载时切换打开的正确脚本片段

发布于 2025-01-07 06:44:49 字数 647 浏览 4 评论 0原文

我正在寻找以下脚本的正确部分用作窗口加载函数,以使图层在加载时切换打开。

这是扩展图层的代码:

$(function() {
Sitemap.init();

});

var Sitemap = { 
Content: null,
Trigger: null,  
init: function() {
    var cc = this;
    cc.Content = $('#Sitemap div.content');
    cc.Trigger = $('#ToggleSiteMap');
    cc.events();
},
events: function() {
    var cc = this;
    cc.Trigger.click(function(){
        cc.Content.slideToggle();
        return false;
    });
}
};

我应该使用哪一部分来创建一个如下所示的 onload 脚本,该脚本将在加载时打开图层?已经尝试了所有元素,但似乎无法让它发挥作用。非常感谢您的帮助。

<SCRIPT TYPE="text/javascript"> window.onload=help needed here;
</SCRIPT>

I am looking for the correct piece of the following script to use as a window load function to get the layer to toggle open on load.

This is the code for expanding the layer:

$(function() {
Sitemap.init();

});

var Sitemap = { 
Content: null,
Trigger: null,  
init: function() {
    var cc = this;
    cc.Content = $('#Sitemap div.content');
    cc.Trigger = $('#ToggleSiteMap');
    cc.events();
},
events: function() {
    var cc = this;
    cc.Trigger.click(function(){
        cc.Content.slideToggle();
        return false;
    });
}
};

Which part should I take to create an onload script like the below that will open the layer on load? Have tried all elements and cant seem to get it to work. Would really appreciate the help.

<SCRIPT TYPE="text/javascript"> window.onload=help needed here;
</SCRIPT>

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

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

发布评论

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

评论(3

感受沵的脚步 2025-01-14 06:44:49

我没有正确理解你的问题。

如果我假设您需要执行站点地图对象的 init() 那么您可以简单地调用 init 函数,如下所示:

window.onload = Sitemap.init();

(function() { 
    Sitemap.init();
})();

Am not getting your question correctly.

If i assume that you need to execute init() of sitemap object then you can simply call init function like this:

window.onload = Sitemap.init();

or

(function() { 
    Sitemap.init();
})();
一片旧的回忆 2025-01-14 06:44:49

如果你想在加载页面时加载 init 函数,你可以像 dis 那样执行。
您的问题不清楚,请详细说明需求

$(window).load(function(){
Sitemap.init();
});

如果您想调用“不等待图像下载”的函数,可以使用它

    $(document).ready(function(){ 
Sitemap.init(); 
});

If you want to load the init function on loading of the page you can do like dis.
Your question is unclear, elaborate more about the need

$(window).load(function(){
Sitemap.init();
});

You can use this if you want to get function invoked "not waitingfor the images to be get downloaded"

    $(document).ready(function(){ 
Sitemap.init(); 
});
野生奥特曼 2025-01-14 06:44:49

通过查看该网站,我发现如果您想以完整视图打开图层,您必须在 HTML 页面上的以下部分中进行更改,

<div id="Sitemap">
<div class="wrp">
<div class="content cF" style="display: none;"></div>    
</div>

将其更改为

<div id="Sitemap">
<div class="wrp">
<div class="content cF" style="display: block;"></div>    
</div>

即可,无需调用任何函数或创建新方法

By looking into the site, i figured that If you want to open the layer in full view you have to make changes in following section on HTML page

<div id="Sitemap">
<div class="wrp">
<div class="content cF" style="display: none;"></div>    
</div>

change it to

<div id="Sitemap">
<div class="wrp">
<div class="content cF" style="display: block;"></div>    
</div>

It will do, no need to call any function , or make new method

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文