Skip to content

Instantly share code, notes, and snippets.

@josephcc
Created November 15, 2013 08:08
Show Gist options
  • Save josephcc/7480812 to your computer and use it in GitHub Desktop.
Save josephcc/7480812 to your computer and use it in GitHub Desktop.
define([
'flight/lib/component',
], function(defineComponent) {
return defineComponent(function() {
this.screenViewerHitMenu = function (e, data) {
var x = data.position.x;
var y = data.position.y;
var html;
html += '<ul class="dropdown-menu" role="menu">';
data.hits.forEach( function(element, index, array) {
html += '<li role="presentation"><a role="menuitem" tabindex="-1" href="#">';
html += element.className;
html += '</a></li>';
});
html += "</ul>";
this.$node.append($(html));
this.$node.css('left', x);
this.$node.css('top', y);
}
this.after('initialize', function() {
this.on(document, 'uiScreenViewerHitMenu', this.screenViewerHitMenu);
});
});
});
@itszero
Copy link

itszero commented Nov 15, 2013

var menu = $('<ul class="dropdown-menu" role="menu"></ul>');
data.hits.forEach( function(element, index, array) {
  var item = $('<li role="presentation"><a role="menuitem" tabindex="-1" href="#"></a></li>');
  item.text(element.className);
  menu.append(item)
});
this.$node.append(item);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment