简体   繁体   English

加载索引后启动锚点

[英]Launch an anchor after index is load

Well, I´m not programmer so I can´t handle this at all. 好吧,我不是程序员,所以我根本无法处理。 I need to launch a part of a website after index is loaded. 加载索引后,我需要启动网站的一部分。 I´ve been trying some jquery without any luck, ie this: 我一直在尝试一些没有任何运气的jquery,例如:

$("document").ready(function() {
    setTimeout(function() {
        $('#tensa-inicio').trigger('click');
    },1000);
});

You can see the site in this url: 3w[dot]tensa[dot]es. 您可以在以下URL中看到该站点:3wtensa [es]。 I need to display the HOME link after index is loaded, but can´t see how to do this. 索引加载后,我需要显示HOME链接,但是看不到该怎么做。

Any help is really appreciated. 任何帮助都非常感谢。

TIA! TIA!

Considering that you are trying to fire click event for the Anchor tag, You can make it work with following script too 考虑到您正在尝试触发Anchor标记的click事件,因此也可以使其与以下脚本一起使用

$("document").ready(function() {
    setTimeout(function() {
        window.location = $('#tensa-inicio').attr('href');
    },1000);
});

Assuming that "tensa-inicio" is the ID of anchor element in the document, you better call the native click() method rather than the jQuery event: 假设“ tensa-inicio”是文档中锚点元素的ID,则最好调用本机click()方法,而不是jQuery事件:

setTimeout(function() {
    var oLink = $('#tensa-inicio');
    if oLink.length === 1)
        oLink[0].click();
},1000);

This was the tweak: 这是调整项:

<script type="text/javascript">
    $(document).ready(function(){    
        $("#sliderpromo").easySlider({
            //auto: true, 
            //continuous: true,
            speed:500,
            pause:6000,
            numeric: true
        }, window.location="#!/tensa-inicio");
    });    
</script>

Now, every time index is loaded, that ID is loaded... ; 现在,每次加载索引时,都会加载该ID ...; ) Thanks to ALL! ) 谢谢大家!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM