javascript - Adding dynamic 'filter' CSS property for IE8 isn't being correctly assigned -


I am trying to allocate the following CSS assets to a DIV in my webpage if the page displayed is IE8 or IE9 browser < Code> background-size property is not being supported. I sniffed the browser and the value of my DIV background image is dynamic, which means it changes with an event on selection. This is my code

  // var msieVersion has been defined previously and it is in nested state // to see if the browser is IE if (msieversion === 8 || msieVersion === 9) Use // // to specify dynamic CSS property and to convert bg image source $ ("# container") to jQuery. ({"Filter": "progid: DXImageTransform.Microsoft.AlphaImageLoader (src = '" + src + ", SizingMethod =' scale ')", "-ms-filter": "Progress: DxImage Transform. Microsoft. Alpha iPod loader Src = '"+ + +"', sizingMethod = 'scale') "}); }  

Now when I inspect the element using the IE Dev tool, then the Filters does not apply. The following inline style is listed in the Format tab (I href has changed but this is correct and is working):

  Background image: url (http: // url / img1 / 1 Jpg); Filters: Przid: Dximage Transforms. Microsoft.alpha imagedloader (src = 'http: //url/img1/1.jpg', skiing method 'scale'); MS Filters: Prodied: DXIMF Transform. Microsoft. Alpha image loader (src = 'http: //url/img1/1.jpg', resize method = 'scale')  

Does anyone know how I can specify Dynamically changing this property (with src value can not be in my style sheet) or can it see what I am doing wrong?

Post-text "itemprop =" text ">

The problem is to add the style tag on the page head:

  if (msieVersion === 8 | | MsieVersion === 9) {$ ('head'). ("& Lt; Style & gt;" + "# Container {" + "Filters: Prozed: DxImG Transforms: Microsoft. Alpha iPods (src = '" + + + '' SizingMethod = 'scale') "+" -am filter: Prozed: Dximage formats. Microsoft.alpha imagedloader (src = '"+ +' 'sizingMethod =' scale ')" + "}" + "&   

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -