Comments (5)
I have tried to add this feature.
You can see it in my fork.
Since I had to add a new argument to handle the selecor, I prefered to pass everything as an object instead of comma separated paramters.
This would break the actual configuration of the library, that's why I didn't create a pull request.
I think passing parameters as
{mouseover: true, delay: 50, selector : '#foo a'}
will make things much readable, but this is a personal opinion.
With my changes, you can now select which link you want to be preloadable by passing a selector to the init function.
InstantClick.init({ selector : 'a.preload' });
from instantclick.
I’m thinking about adding the ability to add data-instant
/data-no-instant
to a non-link element. That would whitelist/blacklist all links in that element.
In your case, you’d enable whitelisting (InstantClick.init(true)
) and then add a data-instant
attribute to the element you’re currently using as your selector. That’d solve your problem, right?
from instantclick.
Can I ask you why do you prefer to use a data attribute instead of using a javascript selector? Is it for performance or for convenience?
from instantclick.
Convenience for the person new to InstantClick. Allowing two ways to do the same thing would duplicate one’s effort to learn how to set up InstantClick.
The only advantage I see from using selectors over data(-no)-instant on a parent attribute is that you can use classes if you prefer. Not worth the drawback of inhibited learning.
from instantclick.
Blacklisting/Whitelisting all links in one container has landed in 64876dc.
from instantclick.
Related Issues (20)
- $timers[$currentLocationWithoutHash] is undefined in addTimer HOT 1
- Uncaught SyntaxError: Unexpected token : HOT 1
- Browsing calls the xhr request multiple times HOT 2
- 'change' fired multiple times HOT 1
- If using relative path, images in target webpage is not loaded properly. HOT 1
- Instant Click loading bar width calculations are based off page width plus width of scrollbar HOT 1
- How to reload content of <head> relative to page ? HOT 3
- [QUESTION] Where I can find the CI service?
- hexo博客添加instantclick打开网页是空白
- Is this package still maintained ???? HOT 1
- Is there any React Router implementation?
- Support for Nuxt.js
- Disable if data-method exists and is not GET
- 4.0 HOT 2
- Stop menu from opening when back button is clicked
- Character encoding
- Scripts with data-no-instant get re-evaluated when pressing the back button
- utteranc.es support
- Cannot read property 'appendChild' of null
- When new page opens with different template the CSS is skipped
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from instantclick.