Have a swiper component and want to display dynamic background image for each slide.
Followed syntax from this post: https://community.wappler.io/t/code-editor-cannot-process-and-save-a-style-with-dynamic-background-property/2361
But cannot get it to work and display image. This is formatting based on the example above:
dmx-style:background-image="'url("' + image + '")'"
image is my dynamic value. All my other dynamic values display and work, just not image.
Teodor
2
The code should be:
dmx-style:background-image="'url("' + image + '")'"
1 Like
Thanks, also tried that, does not work. When I put the value as static style like this:
<div class="swiper-slide" style="background-image:url(https://drive.google.com/uc?export=view&id=0B_koKn2rKOkLbVhsNzdIYmlfN1E)">
it works, but dynamic does not work.
I have the google link as my dynamic value - maybe it cannot be interpreted inside by dmx?
Teodor
4
I just tested myself and it works perfectly fine using:
dmx-style:background-image="'url("' + image + '")'"
Teodor
5
I don't know what this google link is and if it points to an actual image ... ?
Ok, thanks - will investigate and see if I made mistake inside db maybe
yes, using it in static it works and displays image
Teodor
8
I doubt links like this will work. You need a direct link to the file, not a google drive link like that.
Ok, will use something different and test. Static it displays like this:
Teodor
10
I just tested such link with a dynamic value and i see an error in the console, which points to this article: https://www.chromestatus.com/feature/5629709824032768
Maybe check your console as well and see if you get the same problem.
Using Safari Web inspector for mobile I get the status 400 bad request:
Will test with normal links and let you know. Just need to upload images to server first.