Preview set css class

About this forum
These forums have not been active for several years. They're available for search and reference, but a lot of this information is likely out of date.

For current information, try visiting our Knowledge Base.

Home / Support / Custom Module Development / Preview set css class

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #53159

    Jason
    Participant

    Sorry, asking another question over the weekend 😉

    First off I’ll describe what I’m trying to solve, then I’ll describe the feature that I think is needed.

    I’m modifying the built-in heading module (or creating a copy of it) that will have 7 or so built-in styles. This is so there can be consistency across the site.

    Currently I’m setting the style by adding a select field (header_type) that adds a css-class that has all the header styles (font-weight, font-size, color, line-height, letter-spacing).

    The issue is that I’m unable to find a way to set a preview that will change the css class on-the-fly so instead I need to wait for what appears to be a full reload. Is there a better way to accomplish what I’m attempting to do?

    The only thing I can think of is creating my own javascript preview that will toggle the class correctly.

    Thanks!
    Jason

    #53450

    Justin Busa
    Keymaster

    Hey Jason,

    In order to live preview that you’ll need to set the preview type for the header_type setting to none…

    'preview' => array(
        'type'    => 'none'
    )

    Once you’ve done that, you’ll need to write some JavaScript in js/settings.js to add the class when that setting is changed. Let me know if you have any questions about that.

    Justin

    #53456

    Jason
    Participant

    Thanks Justin, I figured as much.

Viewing 3 posts - 1 through 3 (of 3 total)

The forum ‘Custom Module Development’ is closed to new topics and replies.