user1586214
user1586214

Reputation: 35

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:

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

You can see the site in this url: 3w[dot]tensa[dot]es. I need to display the HOME link after index is loaded, but can´t see how to do this.

Any help is really appreciated.

TIA!

Upvotes: 0

Views: 156

Answers (3)

user1586214
user1586214

Reputation: 35

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... ; ) Thanks to ALL!

Upvotes: 0

Shadow Wizard
Shadow Wizard

Reputation: 66389

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:

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

Upvotes: 0

K D
K D

Reputation: 5989

Considering that you are trying to fire click event for the Anchor tag, You can make it work with following script too

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

Upvotes: 1

Related Questions