ChrisWojcik / single-page-nav

jQuery plugin that provides smooth scrolling and advanced navigation for single page websites.
http://chriswojcik.net/demos/single-page-nav/
161 stars 75 forks source link

How can i put an external link #1

Closed Akrosid closed 11 years ago

Akrosid commented 11 years ago

all is working, but when i put an external link it's doesn't work. How can i do for that?

ChrisWojcik commented 11 years ago

That feature isn't available, I've been meaning to add it in. I won't be able to work on this for a few days, but if you want to add it in yourself before I can, I'm sure conditional logic in the plugin would do the trick.

Here are a few ideas on how to target external links only: http://css-tricks.com/snippets/jquery/target-only-external-links/

ChrisWojcik commented 11 years ago

Update: this is now available.

To achieve this, add a class onto the links you want to filter out, for example class="external".

Use the new 'filter' option to filter out these links. ( i.e. ':not(.external)' )

See the demo for a clearer example: http://chriswojcik.net/demos/single-page-nav/

Let me know if you run into any problems!

pankajk1018 commented 10 years ago

Hello chris I am working on a WordPress theme and used your plugin to navigate withing page. I was having same problem and found this filter. But in WordPress nav how can we add aclass dynamically to only that link which have external href value as http://.... Can you please help. Thank you

ChrisWojcik commented 10 years ago

If I understand what you're asking, it sounds like more of a WP development question. I don't develop WP themes regularly, so I'll try to help the best I can.

I did find this article after a quick google search, can't promise it's 100% up to date, but sounds like what you might want on the WP back-end: http://sevenspark.com/how-to/how-to-add-a-custom-class-to-a-wordpress-menu-item

If this is for a theme that will be distributed, I'm not sure if you can rely on the user to add the correct class.

Another option might be to target all links which are external in your navigation with javascript and then add a class to them.

Some jquery approaches for trying to target external links in this way: http://css-tricks.com/snippets/jquery/target-only-external-links/

Like I said, I'm not a wordpress theme developer, so if these don't suit your needs, I'm not sure if there are other WP plugins or options out there that might fit your situation better.