I was wondering if it is possible to use CSS media queries to update the path to an img's src.
The code below is run in a loop to set this. But I want to use the buttons in a "large" folder if the screen resolution is above a certain value.
var $btnImg = $("<img>", {
id : "toolbar_button_" + button.widgetId + "_image",
src : "images/toolbar/buttons/" + button.imageFileName,
alt : button.displayName,
"unselectable" : "on"
});
i.e. I would like the src attribute to be:
src : "images/toolbar/buttons/large" + button.imageFileName,
Can this be done via CSS where I am already capturing the screen resolution for other styling? Or can this only be done using JavaScript, e.g. jQuery?
Many thanks for any help.