ローダーがそこにあるはずです。天気が表示されるとすぐにpreloader
はなくなります。これはsimpleweather.js
プラグインを使用しています。コンテンツの読み込み中にプリローダーを追加するには?
私は使用しようとしました.hide()
.addClass()
。動作していないようです。唯一のアイデアとして
// JS
$(document).ready(function() {
navigator.geolocation.getCurrentPosition(function(position) {
loadWeather(position.coords.latitude+','+position.coords.longitude);
});
function loadWeather(location, woeid) {
$.simpleWeather({
location: location,
woeid: woeid,
unit: 'c',
success: function(weather) {
html = '<h1><i class="wi wi-fw wi-yahoo-'+weather.code+'"></i></h1>';
html += '<h2>'+weather.temp+'°'+weather.units.temp+'</h2>';
html += '<ul><li>'+weather.city+', '+weather.region+'</li>';
html += '<li class="currently">'+weather.currently+'</li></ul>';
$("#weather").hide().html(html).fadeIn("slow");
},
error: function(error) {
$("#weather").html('<p>'+error+'</p>');
}
});
}
});
// HTML
<body>
<div id="weather"></div>
</body>
を--here – Iceman