Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9136571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:58:13+00:00 2026-06-17T08:58:13+00:00

I am learning Coffeescript and trying to convert the following JavaScript code to Coffescript

  • 0

I am learning Coffeescript and trying to convert the following JavaScript code to Coffescript and (I think) I am almost there. Mainly, I am having an issue with making the timer and popover_parent variables global:

$('.some_element').popover(
  {
    delay: { show: 350, hide: 100 }       
  }
);
var timer,
    popover_parent;
function hidePopover(elem) {
    $(elem).popover('hide');
}
$('.some_element').hover(
    function() {
      var self = this;
      clearTimeout(timer);
      $('.popover').hide(); //Hide any open popovers on other elements.
      popover_parent = self
      $(self).popover('show');            
    }, 
    function() {
      var self = this;
      timer = setTimeout(function(){hidePopover(self)},300);                 
});
$('.popover').on({
  mouseover: function() {
    clearTimeout(timer);
  },
  mouseleave: function() {
    var self = this;
    timer = setTimeout(function(){hidePopover(popover_parent)},300); 
  }
});

This is what I have so far:

$ ->
  $('.some_element')
    .popover ->
      delay: {show:350, hide: 100}
$ ->
  hidePopover = (elem) ->
    $(elem).popover('hide')

  $('.some_element').hover(
    ->
      self = $(this)
      clearTimeout(timer)
      $('.popover').hide()
      popover_parent = self
      $(self).popover('show')
    ->
      self = $(this)
      timer = setTimeout(
        ->
          hidePopover(self) 300
      )
  )

$ ->
  $(document).on({
    mouseover: ->
      clearTimeout(timer)
    mouseleave: ->
      timer = setTimeout(
        ->
          hidePopover(popover_parent) 300
      )
  })

Any suggestions would be greatly appreciated.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:58:13+00:00Added an answer on June 17, 2026 at 8:58 am

    I’m not sure if you knew about http://js2coffee.org, but if it works with your code it’s a really quick way to learn how to convert Javascript to Coffeescript. I used it a lot when getting started with coffee.

    It also does compilation of coffee to js, of course.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying my hand at learning node.js using coffeescript but am having trouble
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
Learning java server technologies, trying to clarify some things. There are few technologies that
I have reacently started learning coffescript and was trying to fllow a simple tut.
I am looking for some insight on learning CoffeeScript without learning pure JavaScript. I
learning Hibernate and its really making me crazy i am trying to persist an
I have just started learning Rails, is it required for me to learn CoffeeScript
Learning some VBA. So far, I've constructed this piece of code which should allow
learning Jquery and integrating with PHP - getting there, but have one last challenge
Learning sed, I want to change the drive letter of the following input lines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.