Coder Social home page Coder Social logo

Comments (4)

ChrisWojcik avatar ChrisWojcik commented on August 30, 2024 1

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!

from single-page-nav.

ChrisWojcik avatar ChrisWojcik commented on August 30, 2024

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/

from single-page-nav.

pankajk1018 avatar pankajk1018 commented on August 30, 2024

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

from single-page-nav.

ChrisWojcik avatar ChrisWojcik commented on August 30, 2024

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.

from single-page-nav.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.