Change color of image in javascript

前端 未结 4 1403
滥情空心
滥情空心 2020-12-18 01:47

I want to change the color of a map image dynamically (say from blue to red). And I can\'t use canvas as I have to support IE.Any idea how i can manipulate an image on clien

4条回答
  •  猫巷女王i
    2020-12-18 02:23

    Do it server side and fetch it as a new resource, for example use a transparent spacer image and place the real image URLs as background-image attributes in a set CSS selectors using class names.

    Now changing the className of the image should replace the image shown, no nasty clever stuff needed clientside.

提交回复
热议问题