问题
A massive problem at the moment is that my flexslider DOES NOT load fast enough. The images that are dynamically loaded into the slider from the network report on google chrome show that they aren't loading fast enough.
Theres a big enough delay that im not very happy and ideally would like to make the slider and its images loaded as fast as possibly so the user will not have to wait for it to load.
It is script related or DNS related. IM very confused as to why its taking so long to load.
回答1:
I have since edited the script to this. It has seemed to cut the amount of time, but still loads a tad to slow.
$(document).ready(function () {
var urls = [
'http://fantasyfootballpundits.com/football/?category=Captaincy+Analysis&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=The+Gameweek+Preview&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=In+The+News&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=Pundits+Team&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=Shrewd+Moves&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=Shrewd+Moves&format=json&callback=?',
'http://fantasyfootballpundits.com/football/?category=Guest+Fantasy+Articles&format=json&callback=?'
];
urls.forEach(function (u) {
$.getJSON(u).done(function (data) {
var current = data.items[0];
if (current != null) {
var post = '<li><a href="http://fantasyfootballpundits.com' + current.fullUrl + '"><img src= "' + current.assetUrl + '" alt ="' + current.filename + '"></a></li>';
$('ul.slides').append(post);
}
});
});
});
来源:https://stackoverflow.com/questions/17746038/slider-flexslider-not-loading-fast-enough-on-page-load