Giter VIP home page Giter VIP logo

Comments (3)

jarlah avatar jarlah commented on June 5, 2024

I think a hack would be to reinit the NavBar when i click a link. But is it a good work around ? Nope

from elm-bootstrap.

jarlah avatar jarlah commented on June 5, 2024

it actually works wonderful (the hack), but shall I give it a try to suggest a better way for how to handle this?

from elm-bootstrap.

jarlah avatar jarlah commented on June 5, 2024

The "hack":

        ( ClickedLink urlRequest, _ ) ->
            case urlRequest of
                Browser.Internal url ->
                    case url.fragment of
                        Just _ ->
                            -- If we got a link that included a fragment,
                            -- we ignore this url change, because we dont care about hash urls
                            ( model, Cmd.none )

                        Nothing ->
                            let
                                ( newNavState, newNavCmd ) =
                                    Navbar.initialState NavbarMsg
                            in
                            ( { model | navState = newNavState }
                            , Cmd.batch [ newNavCmd, Nav.pushUrl (Session.navKey (toSession model.page)) (Url.toString url) ]
                            )

                Browser.External href ->
                    ( model
                    , Nav.load href
                    )

from elm-bootstrap.

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.