• Resolved menikan

    (@menikan)


    Is there any way in lazyblock to add or hide a specific part of the code with a toggle in the user interface ?

    For example i only want to add a specific class to my code / element, when the user has chosen so by a toggle in the gutenberg interface:

    <a class="hashscroll" href="{{button-link}}" alt="{{button-text}}">

    Do you know any solution how i could achieve this ? toggling this class=”hashscroll” on or off by the user ?

    Otherwise this would be a nice feature for future updates. The possibility to add or hide parts of the code with a toggle.

    • This topic was modified 6 months, 3 weeks ago by menikan.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter menikan

    (@menikan)

    I just realized i could achieve this by creating a Select-Element and adding the values “hashscroll” or nothing..

    But in other more complex parts it might be useful to have a toggle for bigger sections of code. Havent tried that yet, wether i can put a whole line of code into the value, so it shows up or not.

    <a class="{{link-type}}" href="{{button-link}}" alt="{{button-text}}">
    Plugin Support Alex

    (@fellan91)

    Hello,

    Handlebars supports conditional statements. Learn more about this feature in these resources:
    LazyBlocks documentation: https://www.lazyblocks.com/docs/blocks-code/handlebars/#basic-usage
    Handlebars official guide: https://handlebarsjs.com/guide/builtin-helpers.html
    You can use conditions, loops, and other features to control block layout visibility.
    An upcoming update will add support for custom scripts, allowing more advanced block data manipulation.

    F.e:

    {{#compare link-type "==" 'first-type'}}
    <a class="{{link-type}}" href="{{button-link}}" alt="{{button-text}}">Test Link</a>
    {{/compare}}

    Regards,
    Alex

    • This reply was modified 6 months, 1 week ago by Alex.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘toggle a part of the code on / off ?’ is closed to new replies.