Instalation
Get from "src" folder plugin "switching-layers.js" add it to you header under jQuery library included
This plugin requires jQuery to be included
In example used bootstrap, but you can build layout without it
Have in mind what each data-switch="switch-parent" children top div elements should be absolute and top on each other to show as in example
In your css, you will need to hide with css (display: none) data-switch="switch-parent" children top div elements and show (display: block) when active class added
Call plugin with:
$(function(){ $().switchinglayers({}); }); //or if you want change options
$(function(){ $().switchinglayers({ mainLayer: $("[data-switch='main-layer']"), //you can change el selectors parentSwitch: $("[data-switch='switch-parent']"), //you can change el selectors switchingTime: 3, //pass seconds, it will slow down or increase speed of switching layers activeClassName: "active" //you can change active class name }); });
License
This project is licensed under the MIT License - for this read License.md file