|
117 | 117 |
|
118 | 118 | // Set first background |
119 | 119 | var sliderImg = $('<img/>').addClass('nivo-main-image'); |
120 | | - sliderImg.attr('src', vars.currentImage.attr('src')).show(); |
| 120 | + sliderImg.attr({ |
| 121 | + src: vars.currentImage.attr('src'), |
| 122 | + alt: vars.currentImage.attr('alt') |
| 123 | + }).show(); |
121 | 124 | slider.append(sliderImg); |
122 | 125 |
|
123 | 126 |
|
124 | 127 | // Detect Window Resize |
125 | 128 | $(window).resize(function() { |
126 | 129 | slider.children('img').width(slider.width()); |
127 | | - sliderImg.attr('src', vars.currentImage.attr('src')); |
| 130 | + sliderImg.attr({ |
| 131 | + src: vars.currentImage.attr('src'), |
| 132 | + alt: vars.currentImage.attr('alt') |
| 133 | + }); |
128 | 134 | sliderImg.stop().height('auto'); |
129 | 135 | $('.nivo-slice').remove(); |
130 | 136 | $('.nivo-box').remove(); |
|
221 | 227 |
|
222 | 228 | // Event when Animation finishes |
223 | 229 | slider.bind('nivo:animFinished', function(){ |
224 | | - sliderImg.attr('src', vars.currentImage.attr('src')); |
| 230 | + sliderImg.attr({ |
| 231 | + src: vars.currentImage.attr('src'), |
| 232 | + alt: vars.currentImage.attr('alt') |
| 233 | + }); |
225 | 234 | vars.running = false; |
226 | 235 | // Hide child links |
227 | 236 | $(kids).each(function(){ |
|
275 | 284 | } |
276 | 285 |
|
277 | 286 | $('.nivo-slice', slider).height(sliceHeight); |
278 | | - sliderImg.stop().animate({ |
279 | | - height: $(vars.currentImage).height() |
280 | | - }, settings.animSpeed); |
| 287 | + sliderImg.stop().animate({ height: $(vars.currentImage).height() }, settings.animSpeed); |
281 | 288 | }; |
282 | 289 |
|
283 | 290 | // Add boxes for box animations |
|
315 | 322 | } |
316 | 323 | } |
317 | 324 |
|
318 | | - sliderImg.stop().animate({ |
319 | | - height: $(vars.currentImage).height() |
320 | | - }, settings.animSpeed); |
| 325 | + sliderImg.stop().animate({ height: $(vars.currentImage).height() }, settings.animSpeed); |
321 | 326 | }; |
322 | 327 |
|
323 | 328 | // Private run method |
|
339 | 344 | // Set current background before change |
340 | 345 | if(!nudge){ |
341 | 346 | settings.onNextSlide.call(this); |
342 | | - sliderImg.attr('src', vars.currentImage.attr('src')); |
| 347 | + sliderImg.attr({ |
| 348 | + src: vars.currentImage.attr('src'), |
| 349 | + alt: vars.currentImage.attr('alt') |
| 350 | + }); |
343 | 351 | } else { |
344 | 352 | if(nudge === 'prev'){ |
345 | | - sliderImg.attr('src', vars.currentImage.attr('src')); |
| 353 | + sliderImg.attr({ |
| 354 | + src: vars.currentImage.attr('src'), |
| 355 | + alt: vars.currentImage.attr('alt') |
| 356 | + }); |
346 | 357 | } |
347 | 358 | if(nudge === 'next'){ |
348 | | - sliderImg.attr('src', vars.currentImage.attr('src')); |
| 359 | + sliderImg.attr({ |
| 360 | + src: vars.currentImage.attr('src'), |
| 361 | + alt: vars.currentImage.attr('alt') |
| 362 | + }); |
349 | 363 | } |
350 | 364 | } |
351 | 365 |
|
|
0 commit comments