-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a better JS example instead of Alertifier #82
Comments
I would suggest to think from the end result - What should the example teach/demonstrate? Possible points:
It can be a small helper function, or just a dummy function for demonstrative purposes. |
With these 2 components/modules (
As Vojta wrote,
but defintely not necessary about
|
Also, we can try to resolve the schizophrenia with named vs. arrow functions here. |
for init: "using cookies" message based on version/time
for factory: button triggering collapse (show/hide content)
|
Great idea! |
@zoltan-kovac any luck with the factory/collapse example? If not, I’ll try to do something simple. |
Sorry for interrupting, I've just got an idea come into my mind: Each project I have participated in uses anchor scroll navigation (from regular "Go to top" to custom in-page navigation between anchor breakpoints). Sometimes even such a simple thing as this may cause a lot of extra code (hidden containers for anchors, unnecessary events and hooks in JavaScript). I think this might have been a good and useful JavaScript demo in a devstack. Implementation (approximate)/* anchorNavigator.js */
export default class AnchorNavigator {
constructor(container) {
this.container = container;
this.container.onClick = this.handleClick;
}
handleClick() {
const { scrollTo } = this.container.dataset; // "#" + scrollTo
/**
* Use one of the smooth scroll techniques here.
* I would suggest the method from MDN (no jQuery).
*/
}
} InitializationinitializeMethod(AnchorNavigation, document.querySelectorAll('[data-scroll-to]')); Usage<header id="header"></header>
...
<button data-scroll-to="header">Go to top</button> This would also be a nice example to demonstrate a proper semantics between |
@vbulant I have this branch somewhere. Will put it together during the easter. My solution is animating height with css transitions, with hooks on transitionEnd event. This is the bootstrap approach. If we really want simpler solution, maybe go ahead. |
@kettanaito it's a nice example, but I wouldn't use |
@ronaldruzicka a valid argument. Sure, it was just an example :) P.S. However, now returning to benchmarks regarding There are rarely more than 10 in-page scrolling anchors on the same page, so this optimization may be redundant (best optimization is not to over-optimize). Yet, I would leave it to an open discussion. |
In case anyone wants to continue with @zoltan-kovac’s collapse, it’s pushed here: https://github.com/actum/gulp-dev-stack/tree/82-collapse |
Reasons
no-alert
eslint ruleThe text was updated successfully, but these errors were encountered: