Traditional Culture Encyclopedia - Weather forecast - How to use jquery.simpleweather.js

How to use jquery.simpleweather.js

Just add a reference to jquery.simpleWeather.js on the website. Then initialize simpleWeather, set WOEID, US postal code or location, add a div and weather ID (or whatever you want, just change it in init).

& lt! -html-& gt;

& ltdiv id = " weather " & gt& lt/div & gt;

/* - css - */

Text {

Font: 13px 'Open Sans', "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans serif;

Background: # 0091C2;

}

# Weather {

Width: 425px

Margin: 0px automatic;

Text alignment: centered;

Text conversion: capitalization;

}

# Weather h2 {

Margin: 0 0 8px

Color: # fff

font-size: 150 px;

Font thickness: 300;

Text alignment: centered;

text-shadow:0px 1px 3px rgba(0,0,0,0. 15);

}

# Weather ul {

Margin: 0;

Fill: 0;

}

# Weather Li {

Background: # fff

Background: rgba(255, 255, 255, 0.90);

Filling: 20px

Display: embedded-block;

Border radius: 5px

}

# Weather. Currently {

Margin: 0 20px

}

// - js

$ (document). ready(function() {

Simple weather ({

Postal code:'',

woeid: '2357536 ',

Location:'',

Unit,' f',

Success: Function (Weather) {

html = ' & lt“h2 & gt”+weather.temp+'? '+weather . units . temp+' & lt; /H2 & gt; ';

html+= ' & lt; Ul>& lt "Li>"+weather. city+','+weather. region+'< /Li & gt; ';

html+= ' & lt; "Li class=" at present ">"+weather. Currently+'< /Li & gt; ';

html+= ' & lt; "Li>"+weather. tempalt+'? C</ Li>& lt/ul & gt;; ';

$ ("# Weather"). html(html);

},

Error: Function (Error) {

$ ("# Weather"). html(' & lt; “p & gt”+error+' & lt; /p & gt; ');

}

});

});