jquery - Rails 4 Countdown timer -


Hi IR is trying to implement a countdown clock in a Rail 4 application. I came in Keith Jungle Plugin with a similar question. A simple countdown timer is being done to work on the problem because I can find any simple examples in the Rails 4. I will only add a countdown time when a contest begins like a timer starting from 10 days = days: Hour: min: sec

I downloaded the countdown package and added * = jquery.countdown.css for app / assets / stylesheet / app.css

I added // // jquery.countdown .js My App / Aus For Tion / javasript / application.js and I jquery.countdown CSS in your app / views / layouts folder and JS files added to both. I have a gem 'jquery-rails' gem in my gem file.

Do I put my competition in my competition. Jo.copy file I have

  $ (function () {$ ('# Till2d'). Countdown ({to: '+ 2d'});});  

And it's called in my competition view like

   

My app / scene / contest show.html .... where I want to show the timer

   Prizes: & lt; / Strong> & Lt;% = @ pmpress.prize% & gt; & Lt; / P & gt; & Lt; P & gt; & Lt; Strong> Date: & lt; / Strong> & Lt;% = @ competition.Date%> & Lt; / P & gt; & Lt;% = link_to 'edit', edit_competition_path (@competition)%> | & Lt;% = link_to 'back', competitions_path% & gt; & Lt; H1 & gt; Timer & lt; / H1> & Lt; Div id = "till2d" & gt; & Lt; / Div & gt;  

My thoughts / layout / application.html.erb file where I put the apppriet tag

  & lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Timer & lt; / Title & gt; & Lt;% = stylesheet_link_tag "app", media: "all", "data-turbo-lines-track" = & gt; True% & gt; & Lt;% = javascript_include_tag "applications", "data-turbo-lines-track" = & gt; True% & gt; & Lt;% = csrf_meta_tags% & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "css / jquery.countdown.css" & gt; & Lt; Script type = "text / javascript" src = "js / jquery.plugin.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "js / jquery.countdown.js" & gt; & Lt; / Script & gt; & Lt;% = yield% & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Looks like my app / assets / javascript / apps.js file

  // // requires jquery // jquery_ujs / / = Requires turbolinks // / require_tree // = jquery.countdown.js  

If someone can tell me whether I came on the right track or talk to me on a simple tutorial I would appreciate it thank you

Update your application.js file to:

  // // plus Jquery // is required Jquery_ujs // = requires turbolink // require jquery.countdown.js // where you need  

in front of jquery.countdown.js < The code> requirement was unavailable and you probably need to come before your code.

If this is the problem, maybe you should see something in your Javascript console like "the method does not count down in the [object]" or something that will point to this issue. Also, if you have your javascript If you see the source list (in the browser developer tool or source page), you should see jquery.countdown.js listed (assuming you are running in development mode - because in development mode, asset pipeline up Also different JavaScript so that you can debug the issues of these types).

Update

After reviewing the full code base, it is probably the default fix set up on incorrectly placed JSPsil files and some bad javascript (JavaScript mixed with coffee script comments) But it would be difficult to share other things here. To keep someone interested, a bridge is requested which takes some files around and cleans something to solve this problem.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -