Adaptive and animated section dividers.
Use CDivs to create canvas dividers between sections.
Main work of the script
The element containing a background is selected between two elements.
The element is clipped using clip-path CSS property.
Canvases containing a divider shape are added.
The elements background is reproduced on divider canvases.
The script main features
Each type comes with a light animation that can be customized using options.
Dividers automatically adjust to device pixel ratio.
Dividers sizes depend on screen size.
You can specify sizes and screen breakpoints by options.
Dividers reproduce the element background.
Background color and position is automatically updated.
The script contains 20 types that can be customize using options.
The script contains 10 decorations, which represents cutting shapes from a divider.
Dividers can contain CSS backgrounds of internal elements. Internal elements must be specified in the inners option.
To install the script, you need to include the script in the footer of your page.
You can add dividers by adding attributes or create, change and remove using JavaScript.
By default, internal elements do not participate in dividers. Internal elements added by specifying CSS selectors in the inners option.
... [t]<section [a]data-cdivs[/][e]=[/][s]"type: waves, decor: lines"[/]>[/] ... [t]<script [a]src[/][e]=[/][s]"cdivs.min.js"[/]></script>[/]
[t]<script [a]src[/][e]=[/][s]"cdivs.min.js"[/]></script>[/] [t]<script>[/] [T][t]window[/][d].[/][m]addEventListener[/][b]([/][s]'load'[/], () => [b]{[/] [T][T][l]let[/] [v]divider[/] = [s]new[/] [t]CDivs[/][b]([/][s]'#main-section'[/], [b]{[/] [T][T][T][p]type[/][d]:[/] [s]'waves'[/], [T][T][T][p]decor[/][d]:[/] [s]'lines'[/], [T][T][b]})[/]; [T][b]});[/] [t]</script>[/]
Here you can customize the divider and get its options.
type: skew
type: skew
Options can be set both for all and for one divider.
Click on an option for a more detailed description and example.
You can ask a question at any time on the item page.
The script create dividers on HTML elements containing a CSS background.
The CSS background can be semitransparent and contain multiple images, linear and radial gradients, linear and radial repeating gradients.
<img> elements can be either main and internal elements.
Pseudo-elements can be specified as internal elements only if they are absolutely positioned.
Parallax based on CSS
background-position
or background-attachment
property is automatically updated.
Parallax based on element position requires the scroll option to be enabled.
Type: | |
Default: |