JavaScript Getting client side image width of dynamic image with jquery getting client side value in code behind

I'm trying to write a lightbox that shows an image inside a container when a div is being clicked.

Said div has the actual image to be displayed as a background image, working as a thumbnail.

These images will be loaded by users so I don't have their actual width and height.

So I have a bunch of divs with images as background and a lightbox with a container, image (with an empty src) and description that shows up everytime a thumbnail is clicked.

For that, I used this:

//Set image and description of lightbox

            var imageToDisplay =    $(this).siblings(".selfieImage")
                                    .css("background-image")
                                    .replace(/"/g, "")
                                    .replace(/url\(|\)$/ig, "");

            var descToDisplay =     $(this).siblings(".selfieImage")
                                    .attr("data-description");

            $('.lightBoxImage').attr('src', imageToDisplay);
            $('.lightBoxDescription').text(descToDisplay);

The thing is I don't know how long the description is going to be, and the width of the container is not set as it will take the width of its larger element. However, its height will always be the 50% of the screen, so the images will change its original size.

I want to set the width of the generated image as the width of the container, so the description text will wrap at the bottom of the image.

How can I do that? I read a lot of answers here but none of those seem to work because I already have my lightbox image created with 0,0 dimentions when I load the page. I'm just changing its source, so the onload and ready function don't work as expected.

Answer:1

can anyone tell me why this is not working? ui = (function() { collabElement = document.getElementById( 'approveCollab' ); if(collabElement) collabElement.onclick = function(){editor....

can anyone tell me why this is not working? ui = (function() { collabElement = document.getElementById( 'approveCollab' ); if(collabElement) collabElement.onclick = function(){editor....

I am trying to add markers via Json once a visitor moves the map. For some reason the moveend is not caught and / or the function onClickCallback is not triggered. Where am I going wrong here. ...

I am trying to add markers via Json once a visitor moves the map. For some reason the moveend is not caught and / or the function onClickCallback is not triggered. Where am I going wrong here. ...

I found this code replace(/\\r\\n/g, "<br />"); for replacing newlines into <br /> after entering strings inside a textarea. But I can't find answers on how to save it on database. My ...

I found this code replace(/\\r\\n/g, "<br />"); for replacing newlines into <br /> after entering strings inside a textarea. But I can't find answers on how to save it on database. My ...

How can I interactively jump to a specific slide? Programmatically, I can use Reveal.slide( indexh, indexv, indexf). For instance, in S5, I can enter the slide number and then press Enter.

How can I interactively jump to a specific slide? Programmatically, I can use Reveal.slide( indexh, indexv, indexf). For instance, in S5, I can enter the slide number and then press Enter.

  1. jump slider
  2. jump slider trampoline slide
  3. jump slides in powerpoint
  4. jump slidell
  5. jump slide newton
  6. jump slide boise open
  7. jump & slide with/ ball pit
  8. jump 'n slide bouncer
  9. jump slide rentals
  10. jump slide downtown boise
  11. jump slider trampoline
  12. jump slide apex
  13. jump slide boise id
  14. jump slide bouncer little tikes
  15. jump slide texas
  16. jump slide bloemfontein
  17. jump slider uk
  18. jump slide trampoline
  19. jump slide boise idaho
  20. jump slide schedule