我想让我的<div>内容在我的网站加载时顺利进入.当网站加载时,他们必须一个接一个地出现.而且,背景图像在被过滤后过晚加载weatherType.这是一个localWeather网页,根据您打开页面的位置为您提供天气信息.
注意: - 请在其他第三方Web开发网站上发布代码,codepen.io以便访问API.
这是我的代码:
$(document).ready(function() {
$(".text-center").fadeIn();
var lon, lat, weatherType, ftemp, ktemp, ctemp, wspeed;
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
lon = position.coords.longitude;
lat = position.coords.latitude;
var api = 'https://api.openweathermap.org/data/2.5/forecast?lat=' + lat + '&lon=' + lon + '&appid=bb4b778076b0c8c79c7eb8fcd1fd4330';
$.getJSON(api, function(data) {
// $("#data").html(api);
var city = data.city.name;
weatherType = data.list[0].weather[0].description;
//weatherType="clear sky";
ktemp = data.list[0].main.temp;
console.log(ktemp);
ftemp = (9 / 5 * (ktemp - 273) + 32).toFixed(1);
ctemp = (5 / 9 * …Run Code Online (Sandbox Code Playgroud)我得到一个错误,说'构造函数文件[string]不可见.当我将我的方法和类声明为公共时,为什么我会得到这个.
package appium1;
import static org.junit.Assert.*;
import org.junit.Test;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.gargoylesoftware.htmlunit.javascript.host.file.File;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class desiredcap {
@Test
public void test() {
File appDir = new File("src");
File app = new File(appDir, "BookMyShow.apk");
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Emulator");
}
}
Run Code Online (Sandbox Code Playgroud) constructor ×1
css ×1
eclipse ×1
html ×1
java ×1
javascript ×1
jquery ×1
selenium ×1
string ×1