|
4 | 4 | href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/ |
5 | 5 | css/font-awesome.min.css"> |
6 | 6 | <script language="javascript"> |
| 7 | + function isInternetExplorer() { |
| 8 | + ua = navigator.userAgent; |
| 9 | + /* MSIE used to detect old browsers and Trident used to newer ones*/ |
| 10 | + return ua.indexOf("MSIE ") > -1 || ua.indexOf("Trident/") > -1; |
| 11 | + } |
| 12 | +
|
7 | 13 | /* Define the Animation class */ |
8 | 14 | function Animation(frames, img_id, slider_id, interval, loop_select_id){ |
9 | 15 | this.img_id = img_id; |
|
20 | 26 | this.frames[i] = new Image(); |
21 | 27 | this.frames[i].src = frames[i]; |
22 | 28 | } |
23 | | - document.getElementById(this.slider_id).max = this.frames.length - 1; |
| 29 | + var slider = document.getElementById(this.slider_id); |
| 30 | + slider.max = this.frames.length - 1; |
| 31 | + if (isInternetExplorer()) { |
| 32 | + // switch from oninput to onchange because IE <= 11 does not conform |
| 33 | + // with W3C specification. It ignores oninput and onchange behaves |
| 34 | + // like oninput. In contrast, Mircosoft Edge behaves correctly. |
| 35 | + slider.setAttribute('onchange', slider.getAttribute('oninput')); |
| 36 | + slider.setAttribute('oninput', null); |
| 37 | + } |
24 | 38 | this.set_frame(this.current_frame); |
25 | 39 | } |
26 | 40 |
|
|
183 | 197 | <div class="anim-controls"> |
184 | 198 | <input id="_anim_slider{id}" type="range" class="anim-slider" |
185 | 199 | name="points" min="0" max="1" step="1" value="0" |
186 | | - onchange="anim{id}.set_frame(parseInt(this.value));"></input> |
| 200 | + oninput="anim{id}.set_frame(parseInt(this.value));"></input> |
187 | 201 | <div class="anim-buttons"> |
188 | 202 | <button onclick="anim{id}.slower()"><i class="fa fa-minus"></i></button> |
189 | 203 | <button onclick="anim{id}.first_frame()"><i class="fa fa-fast-backward"> |
|
0 commit comments