Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Change text colour temporarily on data update

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Change text colour temporarily on data update

Post by mikechristelow »

Hi,
I'm trying to find a way of highlighting data values that have changed on my web pages, just for a few seconds and then revert to the standard colour - I'm using HTML and javascript.
I've searched the forum, as I'm sure the answer to this has been posted previously but I can't find it.
Is anyone able to find the previous topic(s) on this?
Thanks,
Mike
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

User avatar
saratogaWX
Posts: 1185
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Change text colour temporarily on data update

Post by saratogaWX »

Sure, that's been a feature of the AJAX script(s) in the Saratoga template sets.

The AJAX script for Cumulus (https://saratoga-weather.org/wxtemplate ... jaxCUwx.js) uses the class="ajax" to mark those entities for AJAX updates, and id="ajax...." for the specific section to be updated.

For example, for temperature the HTML markup would be:

<span class="ajax" id="ajaxtemp">...</span>

When the script runs, the ',..' would be replaced by the current temperature from Cumulus realtime.txt and the 'green flash' of the data would take place for 2 seconds.

You can search the ajaxCUwx.js script for all the set_ajax_obs(...) calls.. that defines all the id="ajax..." that are available.

Hope this helps...

BTW... you can use only ONE instance of id="ajaxtemp" (or other ajax... values) in the HTML on a page due to the HTML restriction that id= values must be unique on a page. If you err and put an additional one of the same id value on the page, only the first one will be used by the script.. that's just the way it works.
User avatar
mikechristelow
Posts: 165
Joined: Wed 01 Feb 2012 9:33 pm
Weather Station: Watson W8681 (solar)
Operating System: Windows XP SP3
Location: Crewe, Cheshire
Contact:

Re: Change text colour temporarily on data update

Post by mikechristelow »

Brilliant, thanks very much - just what I was after. I've implemented a little of this and just need to fine tune it but it does exactly what it says in the tin (and more!).
Thank you!
http://www.christelow.co.uk
“It's snowing still," said Eeyore gloomily.
"So it is."
"And freezing."
"Is it?"
"Yes," said Eeyore. "However," he said, brightening up a little, "we haven't had an earthquake lately.”

Post Reply