Miles
Miles

Reputation: 65

creating a link - jquery slider

Hope someone can help.

Firstly please see - http://designbyaltitude.com/ii/

I have created a content slider using jquery however I want to link the "Click here to read more. " to the about page but can seem to work out how to do it.

Basically I want it to jump to the about us section when click here is pressed

Upvotes: 1

Views: 531

Answers (1)

gilly3
gilly3

Reputation: 91497

It looks like the cycle plugin you are using doesn't expose an easy way to go to a specific image. But, since you've got the nav that already works, you can just trigger a click on the appropriate link.

jQuery("#menu li a:eq(1)").trigger("click");

Edit: To bind a click handler to your link you'll need a way to select it. Best would be to give it a class like aboutUsLink. This way, if you ever want to create another link to the about us page, you don't need to change any script - just give the new link the same class and both will get the click handler. If you give your link a class of aboutUsLink, you can put the following code in the <head>. It causes the about us page to be shown when any element with a class of aboutUsLink is clicked:

<script type="text/javascript">
    jQuery(function() {
        jQuery(".aboutUsLink").click(function () {
            jQuery("#menu li a:eq(1)").trigger("click");
        });
    });
</script>

Upvotes: 2

Related Questions