Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
As title.
For example the image URL field could be updated as soon a file is uploaded.
Comment | File | Size | Author |
---|---|---|---|
#3 | change_opacity_on_the_fly-2538976-3.patch | 1.32 KB | lolandese |
Comments
Comment #1
lolandese CreditAttribution: lolandese commentedSee https://www.drupal.org/node/752056.
We could also include in the demo the opacity slider affecting the image URL preview directly.
Comment #2
MageshwaranN CreditAttribution: MageshwaranN commenteddocument.querySelector('input[type="range"][name="FOO_img_opacity"]').onchange=changeEventHandler;
function changeEventHandler(event) {
var opacity = event.currentTarget.value;
var fallbackOpacity = parseFloat(opacity) * 100;
var imageElement = document.querySelector('img[id="FOO_imgurl-image-preview"]');
imageElement.style.opacity = opacity;
imageElement.style.filter = 'alpha(opacity='+fallbackOpacity+')'; // IE fallback
};
You can add this js snippet on the demo module.
Comment #3
lolandese CreditAttribution: lolandese as a volunteer commentedRolled Magesh's snippet into a patch.
Comment #5
lolandese CreditAttribution: lolandese as a volunteer commentedCommitted with contribution.
Thanks Magesh.
Comment #6
lolandese CreditAttribution: lolandese as a volunteer commentedReopened for the original request to have AJAX when changing the image.