Skip to content

Latest commit

 

History

History
51 lines (45 loc) · 1.11 KB

theme-sample-code.md

File metadata and controls

51 lines (45 loc) · 1.11 KB

// Show dropdowns on hover. A short delay is used to prevent the dropdown being triggered if the // mouse is simply positioned over a dropdown link when the page loads. $(document).on('mouseenter', '[data-toggle="dropdown-hover"]', function(e) { var timer var $el = $(this) var $dropdown = $el.find('.dropdown-menu')

clearTimeout(timer) timer = setTimeout(function() { $el.addClass('show') }, 300)

$dropdown.on('mouseenter', function(e) { clearTimeout(timer) })

$el.on('mouseleave', function(e) { clearTimeout(timer) timer = setTimeout(function() { $el.off('mouseleave') $dropdown.off('mouseenter') $el.removeClass('show') }, 300) }) })

<title>title</title> <script src="script.js"></script>

Ruby Greeter class

class Greeter def initialize(name) @name = name.capitalize end def sayHello puts "Hello #{@name}!" end end

hello = Greeter.new("World") hello.sayHello