-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[scrollspy] New directive v-b-scrollspy #355
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
Conversation
* Create form-input-static.vue New form-static input * Added form-input-static compoinent * Refactored static input Refactored to use the new `<b-form-input-static>` component * Switch to bFormInputStatic Updated child component var to bFormInputStatic to follow proper naming conventions * Removed lazyFormatter from static-input * Added trailing semi-colon To make CircleCI happy * Added missing 'this' * [nav-item] add dropdown class * Added <slot> for robustness * new b-form-input-static component (#292) * Create form-input-static.vue New form-static input * Added form-input-static compoinent * Refactored static input Refactored to use the new `<b-form-input-static>` component * Switch to bFormInputStatic Updated child component var to bFormInputStatic to follow proper naming conventions * Removed lazyFormatter from static-input * Added trailing semi-colon To make CircleCI happy * Added missing 'this' * Added <slot> for robustness * fixed missing `.vue` extension on import * Added missing extension on component import (#293) * Optimized import order in form-input.vue (#294) * Added missing extension on component import * Optimized import order
Resync with master
Resync with master
Resync with master
Resync with master
Resync with Master
Resync with Master
Resync with Master
Added missing bButtonGroupDropdown reference to index.js
Added missing `href="#"` and keydown handlers for SPACE and ENTER
Add b-button-group-dropdown to component list (#350)
|
Wooow this is amazing :) @tmorehouse Any chance creating a Markdown documentation for it instead of inline docs? |
|
Sure. We can base it on the markdown in the PR description. I could (once I figure out how) edit the documentation to add the directive. I left comments in the source file mainly for myself for future documentation. Feel free to remove the usage comments in the file :-) as I have it in the PR request description now. |
Directive v-b-scrollspy
Directive applied to the
b-navorb-navbarelement that you want to have nav-links shown asactivebased on the scrolling of another element (i.e.body).Note: Is applied backwards compared to Bootstrap V4, in that the directive is applied to the target element that has the nav-links, and the option(s) specify the element to monitor scrolling on.
Addresses issue #295
prototype examples:
Monitor Scrolling on a div with fixed
heightandoffset-yset toscrollMonitoring scrolling on the
bodyelementUsage:
Assume body is the scroll element, and use default offset of 10 pixels
Assume body is the scroll element, and use offset of 20 pixels
Element with ID #foo is the scroll element, and use default offset of 10 pixels
Element #foo is the scroll element, and use offset of 20 pixels
Element #foo is the scroll element, and use offset of 25 pixels
Element #foo is the scroll element, and use default offset of 10 pixels (note single quotes around value)
Pass object as config element can be a CSS ID (i.e
#foo), a CSS selector (i.e.body), or a node referenceConfig notes:
bodyDirective syntax
Where:
argis the ID (minus the#) of the element to monitor scrolling on. Optional (defaults tobody. Can be overridden by the option or option after the=mod1&mod2can be anoffsetnumber or stringmethod(see below). Order of the modifiers is not important. Both are optionaloptioncan be a string identifying theelementto monitor scrolling on, a numericoffset, or a configuration object (see below). OptionalConfig object properties:
element:
body. can be an ID (#foo), a css Selector (#foo div), or a reference to an element node. If a CSS string, then the first matching element is used. if an ID is used it must start with#offset:
10method:
method for calculating target offsets.
autowill chooseoffsetif scroll element isbody, else the method ispositionpositionwill calculate target offsets relative to the scroll container.offsetwill calculate the target offsets relative to the top of the window/viewportautothrottle:
If args/modifiers and a value (object or number) is passed, the value takes precedence over the arg and modifiers
If any of the options are invalid types, then an error is written to the console.
Events:
Whenever a target is activated, the event
scrollspy::activateis emitted on$rootwith thetargets HREF (ID) as the argument (i.e.
#bar)