Codeinwp / Nivo-Slider-jQuery

Nivo Slider - The Most Awesome jQuery Image Slider
http://docs.themeisle.com/article/485-getting-started-with-the-nivo-slider-jquery-plugin
MIT License
1.25k stars 605 forks source link

Fixing the "#" problem, that sends a second request to the server. #311

Open amyth91 opened 12 years ago

amyth91 commented 12 years ago

Had problems setting up a payment page, as the nivoslider sends a second request to the server. technically not a second request but points the image src to the current page.

we fixed the problem. line77

balamaci commented 11 years ago

Have the same problem, took a while to find the culprit to be the nivoSlider. In jquery.nivo.slider.js line 77:

    // Set first background
    var sliderImg = $('<img class="nivo-main-image" src="#" />');
    sliderImg.attr('src', vars.currentImage.attr('src')).show();
    slider.append(sliderImg);

the sliderImg because of the src="#" makes the network call it appears even if it was not yet appended to the slider element. I'm guessing the browser/jquery makes some optimizations to request the resources in advance. I've eliminated the 'src="#"' and works ok on Chrome at least. I've updated to just

var sliderImg = $('<img class="nivo-main-image"/>');