I want to use transition
and transform
to make a slider. I use the getPropertyValue
to check the current slide. It works fine in Chrome, but in the IE9 it shows an error: TypeError: Cannot read property '0' of null
(I marked the line with **)
the Javascript
code:
var slider = container.querySelector("ul");
function getCurrSliderIndex() {
var text = slider.style.getPropertyValue("transform");
console.log(text);
var pattern = /[0-9]+/;
**var match = pattern.exec(text)[0];**
var intValue = parseInt(match) / width - 1;
return intValue;
}
the HTML
code:
<ul id="primary-slider" class=" iuiSlider fix" style="width: 3794px; height: 271px; transform: translateX(-1084px);">
<li>some content</li>
<li>some content</li>
<li>some content</li>
...
</ul>