Here you can find out how to add custom style to a layer and set different margin and padding sizes depend on the active breakpoint.
Adding custom styles
You can add a style or class name to the layer element like any other html element. In addition, as Master Slider moves each layer inside a container named frame
, sometimes you need to add style or class name to the frame element not the layer element directly. To add class name, you can use data-frame-class
, for style data-frame-style
and for id data-frame-id
attributes. The example below defines class name and style for the layer frame element.
<div id="masterslider" class="master-slider"> <div class="ms-slide"> <!-- .... --> <div class="ms-layer" data-type="text" data-frame-class="custom-text-layer" data-frame-style="background:red;" > Text layer content here... </div> <!-- .... --> </div> <!-- .... --> </div>
Adding padding and margin
Layers can get different padding and margin values depend on the active breakpoint in the slider. To define it, you can use data-paddingset
and data-marginset
attributes. Margin or padding value for each breakpoint should be separated by comma and the order of the values should be the same as the breakpoints from large to small. The following example adds margin and padding to a text layer.
<div id="masterslider" class="master-slider"> <div class="ms-slide"> <!-- .... --> <div class="ms-layer" data-type="text" data-marginset="30px, 10px 40px, 10px" data-paddingset="10px 15px, 10px 15px 0 30px, 0" > Text layer content here... </div> <!-- .... --> </div> <!-- .... --> </div>