Giter VIP home page Giter VIP logo

Comments (11)

noerw avatar noerw commented on July 28, 2024

I can look into it in the next days.

For the CSS we don't need a new class, this selector should work well.
For JS we could then check for presence of the href attribute instead:

if (!link.hasAttribute('href') || link.getAttribute('href')[0] !== '#'))
    return;

Do you have a suggestion for a better check than href[0] !== '#'?

from leaflet-sidebar-v2.

ChaudhryAtif avatar ChaudhryAtif commented on July 28, 2024

I'm not sure about a better check for href[0], but updating
if (link.hasAttribute('href') && link.getAttribute('href')[0] !== '#')
to
if (!link.hasAttribute('href') || link.getAttribute('href')[0] !== '#'))
would probably be good regardless.

How would this feature impact sidebar.addPanel? One pro of using a class is that sidebar.addPanel would need less changes. You could add an optional property (i.e. anchorClass or tabClass) to set anchor's class when adding it via js, and both should work as expected.

from leaflet-sidebar-v2.

nickpeihl avatar nickpeihl commented on July 28, 2024

The proposed change would allow a sidebar button to act externally of the the sidebar. For example, clicking a gear button on the sidebar could open a modal window rather than a sidebar tab. Please let me know if I'm mistaken.

I'm cautiously supportive of the idea. Implementation needs careful consideration though.

I'm unable to see how the proposed link check would be better. Can someone provide an example? Here's a quick jsbin that compares the existing and proposed link checks with a few scenarios.

from leaflet-sidebar-v2.

noerw avatar noerw commented on July 28, 2024

@nickpeihl This feature exists already. What @ChaudhryAtif wants, is to support this in the html-markup version as well.

The change of the check allows to omit the href="javascript:void(0);" attribute for button-tabs in the markup. (Here's the same test, reworded)

from leaflet-sidebar-v2.

nickpeihl avatar nickpeihl commented on July 28, 2024

@noerw That makes sense to me. Thanks so much for explaining! I'm definitely in favor of this improvement.

from leaflet-sidebar-v2.

noerw avatar noerw commented on July 28, 2024

fixed in 78e4787

from leaflet-sidebar-v2.

ChaudhryAtif avatar ChaudhryAtif commented on July 28, 2024

@noerw Does this account for href being added by addPanel?

from leaflet-sidebar-v2.

noerw avatar noerw commented on July 28, 2024

Why wouldn't it? I tested this, and everything kept working

from leaflet-sidebar-v2.

ChaudhryAtif avatar ChaudhryAtif commented on July 28, 2024

Alright. Thanks for adding the feature!

from leaflet-sidebar-v2.

ChaudhryAtif avatar ChaudhryAtif commented on July 28, 2024

@noerw 3.0.1 (instead of 3.0.2) is the latest for npm install: https://www.npmjs.com/package/leaflet-sidebar-v2

from leaflet-sidebar-v2.

noerw avatar noerw commented on July 28, 2024

sorry. just pushed 3.0.2

from leaflet-sidebar-v2.

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.