Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Add picture into clickable words' explanation box

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 months 2 weeks ago #265091 by dqzhou
Please help us help you and fill where relevant:
Your LimeSurvey version: Version 6.5.9 
Own server or LimeSurvey hosting:
Survey theme/template:
==================
Hi,

I am considering to put the picture into the explanation box of clickable words. For insert text into explanation box, i use the following code which is fine:

<a data-bs-content="xxxxxx" data-bs-placement="top" data-bs-toggle="popover" data-bs-trigger="hover focus" role="button" tabindex="0" title="xx">xx </a> <script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>

But this code is difficult to add the picture into it. I use the following code, which cannot adjust the size of picture. It is showed in the attached picture.

<a data-bs-content="&lt;img  data-cke-saved-src='/upload/surveys/411885/images/parcelsize_ENG.png' src='/upload/surveys/411885/images/parcelsize_ENG.png' style='width: 10px; height: 10px;' /&gt;" data-bs-placement="top" data-bs-toggle="popover" data-bs-trigger="hover focus" id="popoverTrigger" role="button" tabindex="0">Parcel size</a> <script>
  // Initialize popover
  var popoverTrigger = document.getElementById('popoverTrigger');
  var popover = new bootstrap.Popover(popoverTrigger, {
    html: true
  });
</script>
 
Can you help me to solve this problem?

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 2 weeks ago #265092 by tpartner
This is a question for a Bootstrap forum. It is not a LimeSurvey issue.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 2 weeks ago - 11 months 2 weeks ago #265093 by Joffm
Hi, I used the example shown in the bootstrap docs.
[url] getbootstrap.com/docs/5.3/components/popovers/ [/url]
As said there 
[url] getbootstrap.com/docs/5.3/content/images/ [/url]
Images in Bootstrap are made responsive with .img-fluid.

So set the popover container to the desired width and enter your images with class="img-fluid".
But in your css set the width to 25% (four images)

width of popover: 400px
 

width of popover: 800px
 

Better use the source code editor to enter the code. The HTML editor seems to spoil it.
Code:
<span data-bs-content='<img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_02.jpg"  class="img-fluid" ><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_05.jpg"  class="img-fluid"><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_16.jpg" class="img-fluid" alt=""><img src="https://www.mysurvey.de/userfiles/Hamburg-Ballett_10.jpg" class="img-fluid"  alt="">' data-bs-toggle="popover" data-bs-trigger="hover focus" data-bs-placement="right" data-bs-html="true" >Ballett Scenes </span>
 
<script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>
 
<style type="text/css">
.popover {
  max-width:800px;
}
.img-fluid {
  max-width:25%;
}
</style>


Joffm
I hope I did not misunderstand.

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 11 months 2 weeks ago by Joffm.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 months 2 weeks ago #265094 by dqzhou
Hi Joffm,

Thank you very much! I adjust your code as follows.

But the new problem happens. As shown in attached picture, there is a long blank space in the explanation box. And I also do not see the relevant code to adjust the box length, and size of inserted pictures. 
 
<span data-bs-content="&lt;img data-cke-saved-src=&quot;/upload/surveys/411885/images/parcelsize_ENG.png&quot; src=&quot;/upload/surveys/411885/images/parcelsize_ENG.png&quot; class=&quot;img-fluid&quot;  alt=&quot;&quot;&gt;" data-bs-html="true" data-bs-placement="right" data-bs-toggle="popover" data-bs-trigger="click hover focus">parcel size </span> <script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>
<style type="text/css">.popover {
  max-width:200px;
}
.img-fluid {
  max-width:100%;
}
</style>
 

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 2 weeks ago #265095 by tpartner

This is a question for a Bootstrap forum. It is not a LimeSurvey issue.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 2 weeks ago - 11 months 2 weeks ago #265099 by Joffm
Why don't you do what you are told?
You obviously still used the HTML editor.
You see the garbage in the result. Now nobody can see if you ordered the nested quotes correctly.

And did you read this?
[url] getbootstrap.com/docs/5.3/content/images/#responsive-images [/url]
There you see:
Images in Bootstrap are made responsive with .img-fluid. This applies max-width: 100%; and height: auto; to the image so that it scales with the parent width.

So it is not necessary that you set the max-width again to 100%.
You see that I set it to 25%, because yesterday you inserted four images.

I still do not see any issue with this
Code:
<span data-bs-content='<img src="https://www.myserver.de/img/myImage.jpg" class="img-fluid"  alt="">' data-bs-html="true" data-bs-placement="right" data-bs-toggle="popover" data-bs-trigger="hover focus">parcel size </span>
 
<script>
$(function () {
  $('[data-bs-toggle="popover"]').popover();
});
</script>
 
<style type="text/css">
.popover {
  max-width:300px;
}
</style>

 

And, as @tpartner: It's more bootstrap related.

Joffm

BTW: If you use bootstrap, you should use the "Color and background helpers"
[url] getbootstrap.com/docs/5.3/helpers/color-background/ [/url]
"text-success" instead of "good"
"text-danger" insted of "error"
...

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 11 months 2 weeks ago by Joffm.

Please Log in to join the conversation.

  • dqzhou
  • dqzhou's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
11 months 2 weeks ago #265116 by dqzhou
Hi Joffm,

I check with the Limesurvey, I notice my code is auto-changed to HTML. Even I do not select the box of 'Enable/Disable HTML Tag Autocomplete', it is also auto-picked. That's why you see my HTML structure.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
11 months 2 weeks ago #265122 by Joffm
I suppose you do not know where to select the editor mode.
You select it in your account (upper right corner)
 
and it looks like this ( a simple entry field)
 

Joffm
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
11 months 2 weeks ago #265125 by DenisChenu
Replied by DenisChenu on topic Add picture into clickable words' explanation box
My advice : choose popup :)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose