Norman
Norman

Reputation: 805

Give renderObj = IMAGE a class

I want to use a lazy-loader for my images. Therefore I found a JS which seems pretty comfortable. Nevertheless, my images need a class="lazy" so that the JS knows which images it should affect.

The problem is, that I'm using a dynamically generated page with images which are stored in the media relation of each page. Idk if you guys understood what i meant :D

But anyway, that's not the point. The point is, I need a way to give the rendered images a class by TypoScript. I'm looking for something like this:

[...]

renderObj = IMAGE
renderObj {
    file.import.data = file:current:publicUrl
    altText.data = file:current:title

    addClass = lazy
}

[...]

Upvotes: 0

Views: 1506

Answers (1)

Viktor Livakivskyi
Viktor Livakivskyi

Reputation: 3228

You can use params for this:

[...]

renderObj = IMAGE
renderObj {
    file.import.data = file:current:publicUrl
    altText.data = file:current:title

    params = class="lazy"
}

[...]

Upvotes: 2

Related Questions