Use simpleWeather jquery plugin with Hype


(Jeroen) #1

Hello,

I’m trying to use the external simpleWeather jquery plugin with Hype. But I don’t get it to work. I don’t know if I’m doing it in the right way.

I’m using the Bare minimum example: http://codepen.io/fleeting/pen/xwpar

I use a rectangle called ‘weather’ and id ‘weather’. The js script example will start when scene is loading. I’ve uploaded the compressed (jquery.simpleWeather.min.js) simpleWeather file in Hype. But it doesn’t work. I also included the jquery library but also no luck.

Here is my demo file: weather-test.zip (12.4 KB)

Here are the files of the plugin: monkeecreate-jquery.simpleWeather-3.1.0-3-g0d95e82.zip (30.5 KB)

I hope someone can help me with the script and tell me what I’m doing wrong.

Thanks


(Mark Hunte) #2

You were missing the JQuery plugging.

But even when I added it I was getting errors

So I linked directly to the weather and jQuery plugins in the head.

 <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
 <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery.simpleWeather/3.1.0/jquery.simpleWeather.min.js'></script>

Also who ever wrote the style code uses html tag in the styles to plant the background image.
This does not work,( within hype) and I have not looked at it too closely but imho is not something I would do.

I changed that to use the #weather id of the rectangle.

Also in the JS they use html as a global var.

I have changed this to
weatherHTML

weather-test.hype.zip (12.8 KB)


Hype 3 with Simple Weather plugin
(Lucky) #3

did you get the errors because you loaded the jQuery second?
because it works for me
weather-test 2.zip (47.5 KB)
Also i used this library this week for an ad that called on weather, if you want a hype example of this library being used here’s a source file
ad_banner.zip (285.5 KB)
It gets Toronto’s weather tommorow and because client only had 4 weather state images i had to take yahoo’s conditions and break them down into 4.

var cloud = [0,1,2,3,4,19,20,21,22,23,24,26,27,28,29,30,44]
   ,rain=[6,8,9,10,11,12,35,37,38,39,40,45,17]
   ,snow = [5,7,13,14,15,16,17,18,25,41,42,43,46]
   ,sun = [31,32,33,34,36,3200];

(Mark Hunte) #4

Not sure I t man have been a version clash…


(Jeroen) #5

Thanks for the reply’s and suggestions. I’m going to check the new script.
And also thanks for the hype example with the library.
I can go further with the project!