{"title":"Adding Layer Actions","id":51974,"link":"https:\/\/env.averta.net\/en\/step\/adding-layer-actions\/","parent":[51827],"content":"<p>Layer actions let you make layers interactive, for example you can set a layer to start the slideshow when users click on it or hides another layer when it is clicked. You can use any <a href=\"https:\/\/env.averta.net\/en\/step\/adding-layer-actions\/?b=,\" title=\"Adding Layer Actions\">slider API<\/a> function as a layer action. To define a layer action, you need to add it by <code>data-action<\/code> class name.<\/p>\n<h2>Syntax<\/h2>\n<p>You can add multiple actions on one layer by separating each action with <code>;<\/code>. Defining actions is similar to calling a JS function but you don&#8217;t need to put string type parameters inside <code>\"<\/code> or <code>'<\/code> characters. For example <code>hideLayer(logo, 10);<\/code>.<\/p>\n<pre class=\"lang:xhtml decode:true \">\t&lt;div id=\"masterslider\" class=\"master-slider\"&gt;\r\n\t\t&lt;div class=\"ms-slide\"&gt;\r\n\t\t\t&lt;!-- .... --&gt;\r\n\t\t\t&lt;div class=\"ms-layer\"\r\n\t\t\t\t\t data-type=\"text\"\r\n\t\t\t\t\t data-action=\"hideLayer(logo, 10); next();\"\r\n\t\t\t&gt;\r\n\t\t\t\tText layer content here...\r\n\t\t\t&lt;\/div&gt;\r\n\t\t\t&lt;!-- .... --&gt;\r\n\t\t&lt;\/div&gt;\r\n\t\t&lt;!-- .... --&gt;\r\n\t&lt;\/div&gt;<\/pre>\n<p>In the example above, when user clicks on the text layer, slider moves to next slide and hides a layer with id name <code>logo<\/code>.<\/p>\n<h2>Action event<\/h2>\n<p>You are able to change the action call event from <code>click<\/code> to any other mouse event like <code>mouseenter<\/code>. To change it, you can set the event name by <code>data-action-on<\/code> attribute. For example:?<code>data-action-on=\"mouseenter\"<\/code><\/p>\n","type":"solution"}