Javascript in section

You can refer to the code below to write javascript in .lh files

{section-folder}/section.lh

@schema
{
    "name" : "First Section",
    "author" : "LayoutHub Team",
    "website" : "https://www.LayoutHub.com",
    "version" : "1.0",
    "vendors" : {
        "hub_vendor_css": "assets/css/base.css"
    },
    "configs" : {}
}
@endschema

<div class="lh-container">
    <div>Your first setting is {{section.settings.first}}</div>
</div>

@javascript
    /* Javascript code in here */
    alert('This is demo section');
@endjavascript

Last updated