mrchimp / hashy Goto Github PK
View Code? Open in Web Editor NEWHash link fix.
Hash link fix.
and offset in the usual way
A non-jQuery version would be great.
Needed even without publishing to NPM.
Otherwise npm install github:mrchimp/hashy
fails.
Any thoughts on pushing this to the npm repo?
I've got a use case where I'm scrolling to an element and I don't want to update the url bar. Would be nice to disable to setHash inside scrollToHash.
a[href*=#]:not([href=#])
A number of extra pixels to add to scroll-to value.
Here, have some code.
$('a[href*=#]:not([href=#])').click(function(e) {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&& location.hostname == this.hostname) {
The ability to set the animation type, e.g. swing, ease, linear etc as part of the initialization process would be useful.
I have a use case where I am using the global selector, e.g. .js-hashy-link and depending on the link I'd like to have different offset values.
I could use scrollToHash, but then I'd have to write a bunch of extra JS code.
How about being able to set the offset via a data attribute?
<a href="#foo" class="js-hashy-link" data-hashy-offset="100">Thing</a>
Pixel values and percentages would be ideal.
Thoughts? Is there a better way?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.