Sticky Sidebar Sticky Sidebar is a pure Java. Script plugin for making smart and high performance sticky sidebar, works with sidebar if its taller or shorter than the viewport, integrated with resize sensor to re calculate the dimensions automatically when the size of sidebar or its container is changed, supports j. QueryZepto and compatible with Firefox, Chrome, Safari, and IE9. Source can be found on Github. Why sticky sidebar is awesome Examples. Installation. Usage. Configure Your CSSOptions. Backbones only hard dependency is Underscore. js 1. 8. 3. For RESTful persistence and DOM manipulation with Backbone. View, include jQuery 1. 11. 0. Jquery. fileDownload. js Library jQuery File Download is a cross server platform compatible jQuery plugin that allows for an Ajaxlike file download experience. Events. Public Methods. Scrolling Performance. Browser Compatibilityj. QueryZepto No Conflict. It does not re calculate all dimensions when scrolling, just neccessary dimensions. Super smooth without incurring scroll lag or jank and no page reflows. Integrated with resize sensor to re calculate all dimensions of the plugin when the size of sidebar and its container is changed. It has event trigger on each affix type to hook your code under particular situations. Handle the sidebar when it is tall or too short compared to the rest of the container. Zero dependencies and super simple to setup. Examples. Basic. Just call new Sticky. SidebarELEMENT on the element that you want it to be sticky when scrolling updown inside their parent. Sticky. Sidebarsidebar,top. Spacing 2. 0 Basic Example. Sticky sidebar is smart enough to handle sidebar when its taller than the viewport. You dont have to worry about content, it will scroll the sidebar independently, up and down. Sidebarsidebar,top. Spacing 2. 0 Scrollable Sticky Element. Installation. You can install sticky sidebar plugin from Bower, NPM or just simply download it from Git. Hub then put sticky sidebar. Bower. If you are using Bower as package manager bower install sticky sidebar. NPMIf you are using NPM as package manager npm install sticky sidebar. Usage. Your websites HTML structure has to be similar to this in order to work lt dividmain contentclassmain lt dividsidebarclasssidebar lt divclasssidebarinner lt Content goes here lt div lt div lt dividcontentclasscontent lt Content goes here lt div lt div Note that inner sidebar wrapper. For the above example, you can use the following Java. Script lt script typetextjavascriptsrc. jssticky sidebar. Sticky. Sidebarsidebar,container. Selector main content,inner. Wrapper. Selector. Spacing 2. 0,bottom. Spacing 2. 0 lt script Usage with j. QueryZepto. You can configure sticky sidebar as a j. Query plugin, just include jquery. Query plugin. sidebar. Sidebar. top. Spacing 6. Spacing 6. 0. Make sure to include jquery. Integrate Resize. Sensor. js into sticky sidebar to detect when sidebar or container is changed. To use resize sensor with this plugin just make sure to include Resize. Sensor. js before sticky sidebar. Sensor option enabled by default and it will work. If you choose not to include Resize. Sensor. js, sticky sidebar will not have automatic resize detection and still continue to work without any problem. Configure Your CSSNext you are going to need some CSS just to improve performance and prevent repainting on scrolling. Sticky sidebar plugin doesnt add below styles as inline so you need to add them manually in your stylesheet. For browsers dont support translate. Options. Sticky sidebar plugin comes with options to configure how it works. All options below are optional. Default values are presented below. Sidebarnew. Sticky. Sidebarsidebar,top. Spacing 0,bottom. Spacing 0,container. Selector false,inner. Wrapper. Selector. Sensor true,sticky. Class is affixed,min. Width 0 top. Spacing. Additional top spacing of the element when it becomes sticky. Default 0. varsidebarnew. Sticky. Sidebar. Spacing 5. 0 bottom. Spacing. Additional bottom spacing of the element when it becomes sticky. Default 0. varsidebarnew. Sticky. Sidebar. Spacing 5. 0 container. Selector. Specify a container sidebar to limit the begin and end points of sticky element. Defaults to the closest parent of the sticky element. It is highly recommended to specify a container selector. Sticky. Sidebar. Selector. container inner. Wrapper. Selector. Inner wrapper selector of sticky sidebar, if this wrapper is not found inside sidebar element, the plugin will create one for you under class name inner wrapper sticky. It is highly recommended to write inner wrapper of sidebar yourself than add its selector to this option. Default. inner wrapper sticky. Sticky. Sidebar. Wrapper. Selector. Sensor. If sticky sidebar has Resize. Sensor. js integrated, when the size of sidebar or its container element is changed the plugin will re calculate all dimensions. This option allows you to enable or disable resize sensor feature. Default true. Note This option wont work even Resize. Sensor. js is included into your page, more details in Usage with Resize. Sensor. js section. Sticky. Sidebar. Sensor true sticky. Class. The name of CSS class which will be added to the sidebar element when it becomes sticky. Default is affixed. Sticky. Sidebar. Class is affixed min. Width. The sidebar returns to its normal position when the width of window is below this value. Default 0. varsidebarnew. Sticky. Sidebar. Width 3. 00 Events. Sticky sidebar plugin has various events which are triggered when affix state changes. Sidebar Fires immediately before the element has been affixed to the top of the viewport. Sidebar Fires immediately after the element has been affixed to the top of the viewport. Sidebar Fires immediately before the element has been affixed to the bottom of the viewport. Sidebar Fires immediately after the element has been affixed to the bottom of the viewport. Sidebar Fires immediately before the element has been affixed to the bottom of the container. Sidebar Fires immediately after the element has been affixed to the bottom of the container. Sidebar Fires immediately before the element is no longer bottomed out. Sidebar Fires immediately after the element is no longer bottomed out. Sidebar Fires immediately before the element has returned to its position. Sidebar Fires immediately after the element has returned to its position. For example if you want to detect when element sticks to top and bottom we might do varsidebardocument. Element. By. Idsidebar varsticky. Sidebarnew. Sticky. Sidebarsidebar sidebar. Event. Listeneraffix. Sidebar,functionconsole. Sidebar has stuck top of viewport. sidebar. Event. Listeneraffix. Sidebar,functioneventconsole. Sidebar has stuck bottom of viewport. Public Methodsupdate. Sticky Force re calculation of all cached dimensions of sidebar, container and viewport and update position of sidebar according to the new dimensions. The same function of trigger event update. Sidebarnew. Sticky. Sidebar. sidebar sticky. Sidebar. update. Sticky destroy remove all inline styles, helper classes and event listeners. Sidebarnew. Sticky. Sidebar. sidebar sticky. Sidebar. destroy Sticky sidebar plugin takes scrolling preformance very seriously, Its built from the ground up to let you have sticky elements without incurring scroll lag or jank. The biggest cause of scrolling jank is on. Scroll has a lot of work. But in this plugin we cached all dimensions as well as adding will change transform and working with translateY, X instead of top Y Left X that increased performance significantly, while building Sticky sidebar plugin we prevent repainting and reflow to make it as smooth as possible. Browser Compatibility. Sticky sidebar works in all modern browsers including Internet Explorer 9 and above, but if you want it to work with IE9, you should include request. Animation. Frame polyfill before sticky sidebar code. If you have any issue with browser compatibility, dont hesitate to Submit an issue. QueryZepto No Conflict. Sometimes sticky sidebar plugin conflicts with other plugins. In this case, namespace collisions can occasionally occur. If this happens, you may call. Conflict on the plugin to revert the value of. Sidebar. varsticky. Sidebar. fn. sticky. Sidebar. no. Conflict Returns. Sidebar assigned value. Sidebarsticky. Sidebar Give. Sidebar functionality. Author. Ahmed Bouhuolia Git. HubFacebookTwitter. License. MIT License. Java. Script Bootstrap. Documentation. Individual or compiled. Plugins can be included individually using Bootstraps individual. Do not attempt to include both. Both bootstrap. js and bootstrap. Plugin dependencies. Some plugins and CSS components depend on other plugins. If you include plugins individually, make sure to check for these dependencies in the docs. Also note that all plugins depend on j. Query this means j. Query must be included before the plugin files. Consult our bower. Query are supported. Data attributes. You can use all Bootstrap plugins purely through the markup API without writing a single line of Java. Script. This is Bootstraps first class API and should be your first consideration when using a plugin. That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the document namespaced with data api. This looks like this. Alternatively, to target a specific plugin, just include the plugins name as a namespace along with the data api namespace like this document. Programmatic APIWe also believe you should be able to use all Bootstrap plugins purely through the Java. Script API. All public APIs are single, chainable methods, and return the collection acted upon. ClassfatAll methods should accept an optional options object, a string which targets a particular method, or nothing which initiates a plugin with default behavior my. Modal. modal initialized with defaultsmy. Modal. modalkeyboard false initialized with no keyboardmy. Modal. modalshow initializes and invokes show immediatelylt p Each plugin also exposes its raw constructor on a Constructor property. Constructor. If youd like to get a particular plugin instance, retrieve it directly from an element relpopover. No conflict. Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call. Conflict on the plugin you wish to revert the value of. Button. fn. button. Conflict return. Btnbootstrap. Button give. Btn the Bootstrap functionality. Events. Bootstrap provides custom events for most plugins unique actions. Generally, these come in an infinitive and past participle form where the infinitive ex. As of 3. 0. 0, all Bootstrap events are namespaced. All infinitive events provide prevent. Default functionality. This provides the ability to stop the execution of an action before it starts. my. Modal. onshow. Default stops modal from being shownThird party libraries. Bootstrap does not officially support third party Java. Script libraries like Prototype or j. Query UI. Despite. Conflict and namespaced events, there may be compatibility problems that you need to fix on your own. Ask on the mailing list if you need help. About transitions. For simple transition effects, include transition. JS files. If youre using the compiled or minified bootstrap. Whats inside. Transition. End events as well as a CSS transition emulator. Its used by the other plugins to check for CSS transition support and to catch hanging transitions. Examples. Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults. Overlapping modals not supported. Be sure not to open a modal while another is still visible. Showing more than one modal at a time requires custom code. Static example. A rendered modal with header, body, and set of actions in the footer. lt divclassmodal fade lt divclassmodal dialog lt divclassmodal content lt divclassmodal header lt buttontypebuttonclassclosedata dismissmodalaria hiddentrue times lt button lt h. Modal titlelt h. One fine body hellip lt p lt div lt divclassmodal footer lt buttontypebuttonclassbtn btn defaultdata dismissmodal Closelt button lt buttontypebuttonclassbtn btn primary Save changeslt button lt div lt div lt. Live demo. Toggle a modal via Java. Script by clicking the button below. It will slide down and fade in from the top of the page. Text in a modal. Duis mollis, est non commodo luctus, nisi erat porttitor ligula. Popover in a modal. This button should trigger a popover on click. Tooltips in a modal. This link and that link should have tooltips on hover. Overflowing text to show scroll behavior. Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla. Launch demo modal. Button trigger modal lt buttonclassbtn btn primary btn lgdata togglemodaldata targetmy. Modal. Launch demo modal. Modal lt divclassmodal fadeidmy. Modaltabindex 1roledialogaria labelledbymy. Modal. Labelaria hiddentrue lt divclassmodal dialog lt divclassmodal content lt divclassmodal header lt buttontypebuttonclassclosedata dismissmodalaria hiddentrue times lt button lt h. Modal. Label Modal titlelt h. Closelt button lt buttontypebuttonclassbtn btn primary Save changeslt button lt div lt div lt. Make modals accessible. Be sure to add roledialog to. Modal. Label attribute to reference the modal title, and aria hiddentrue to tell assistive technologies to skip the modals DOM elements. Additionally, you may give a description of your modal dialog with aria describedby on. Usage. The modal plugin toggles your hidden content on demand, via data attributes or Java. Script. It also adds. Via data attributes. Activate a modal without writing Java. Script. Set data togglemodal on a controller element, like a button, along with a data targetfoo or hreffoo to target a specific modal to toggle. lt buttontypebuttondata togglemodaldata targetmy. Modal Launch modallt button Via Java. Script. Call a modal with id my. Modal with a single line of Java. Script my. Modal. Options. Options can be passed via data attributes or Java. Script. For data attributes, append the option name to data, as in data backdrop. Nametypedefaultdescriptionbackdropboolean or the string statictrue. Includes a modal backdrop element. Alternatively, specify static for a backdrop which doesnt close the modal on click. Closes the modal when escape key is pressedshowbooleantrue. Shows the modal when initialized. If a remote URL is provided, content will be loaded via j. Querys load method and injected into the root of the modal element. If youre using the data api, you may alternatively use the href attribute to specify the remote source. An example of this is shown below lt adata togglemodalhrefremote. Click melt a Methods. Activates your content as a modal. Accepts an optional options object. my. Modal. modalkeyboard false. Manually toggles a modal.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
November 2017
Categories |