Created countdown clock and suddenly stopped working.

matthew.wren's Avatar

matthew.wren

17 Mar, 2016 02:39 PM

Hello,

I created a countdown clock for our commencement weekend page and it was working yesterday and now it isn't. I only edited the Data Definition for the block that contained the datetime selector. I removed a superfluous datetime picker and it seems to have broken my clock. I'm not sure how to fix the issue.

I've attached an image of how it looks while working and how it looks now.

I created a block that holds the time of commencement and it's sharing the region of a velocity format with javascript within.

The script seems to be pulling the date into milliseconds just fine but it's not doing what it used to do.

<script type="text/javascript">// <![CDATA[
$(function(){
    var note = $('#note'),
            ts = new Date($_XPathTool.selectSingleNode( $contentRoot, '/system-data-structure/countdown').value),
            newYear = true;
        if((new Date()) > ts){
                // The new year is here! Count towards something else.
                // Notice the *1000 at the end - time must be in milliseconds
                ts = (new Date()).getTime() + 10*24*60*60*1000;
                newYear = false;
        }
        $('#countdown').countdown({
                timestamp       : ts,
                callback        : function(days, hours, minutes, seconds){
                        var message = "Today is the day!";
                        message += days + " day" + ( days==1 ? '':'s' ) + ", ";
                        message += hours + " hour" + ( hours==1 ? '':'s' ) + ", ";
                        message += minutes + " minute" + ( minutes==1 ? '':'s' ) + " and ";
                        message += seconds + " second" + ( seconds==1 ? '':'s' ) + " <br />";
                       note.html(message);
                }
        });
}); // ]]></script>

I'm not sure how to fix this and all I did was removed an unused data definition field. Any advice?

  1. 1 Posted by matthew.wren on 18 Mar, 2016 02:17 PM

    matthew.wren's Avatar

    I found out the issue! Small syntax error on the javascript file preventing the divs from creating in the container.

  2. Support Staff 2 Posted by Tim on 18 Mar, 2016 02:37 PM

    Tim's Avatar

    Glad to hear you were able to track this down, Matthew. Thanks for the update!

  3. Tim closed this discussion on 18 Mar, 2016 02:37 PM.

Discussions are closed to public comments.
If you need help with Cascade CMS please start a new discussion.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

 

26 Aug, 2016 01:19 PM
25 Aug, 2016 03:02 PM
25 Aug, 2016 12:50 PM
24 Aug, 2016 08:43 PM
24 Aug, 2016 07:20 PM
21 Aug, 2016 01:20 PM