Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G g1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 68
    • Issues 68
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cto
  • g1
  • Issues
  • #107

Closed
Open
Created Nov 12, 2018 by S Anand@s.anandOwner

Trigger simple hashchange events

Summary

When the URL hash changes, trigger a #?key event on the window.

Benefits

This makes it easier for developers to write URL-driven applications.

To change state, just add <a href="#?key=val" class="urlfilter" data-target="#">

To respond to state, don't use $('a').on('click'). Instead, use $(window).on('#?key').

Usage

For example, if the URL changes from /page to /page#?state=Goa, you can listen to $(window).on('#?state', function(state) { ... }) will be triggered with Goa as the state.

It will also trigger $(window).on('#?', function(url) { ... }) where url is a g1 parsed URL.

To enable this, just run $(window).urlchange(options).

Instead of window, we can run this on iframes and any other urlfilter target too.

Edited Nov 12, 2018 by S Anand
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking