Skip to content

Commit

Permalink
Got popovers to work as jQuery plugin and Require.js module, started …
Browse files Browse the repository at this point in the history
…JS menu interface.
  • Loading branch information
alcinnz committed Aug 12, 2012
1 parent f30b8dc commit e6d1f82
Show file tree
Hide file tree
Showing 3 changed files with 11,675 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyofwave_client/proto/modal.html
Expand Up @@ -8,7 +8,7 @@
<script>
$(function() {
$('button').each(function() {
var popup = $(this).popover($('#'+$(this).attr('data-for')))
var popup = $('#'+$(this).attr('data-for')).popover()
$(this).click(function(evt) {
evt.stopPropagation()
popup(this)
Expand Down
17 changes: 13 additions & 4 deletions pyofwave_client/proto/modal.js
@@ -1,11 +1,11 @@
define(['../src/api/jquery-1.5.1.js', '../src/api/jqueryUI/jquery-ui-1.8.14.custom.js', '../src/api/farbtastic.js'], function($) {
define(['../src/api/jquery-1.5.1.js', '../src/api/jqueryUI/jquery-ui-1.8.14.custom.js', '../src/api/farbtastic.js'], function() {
var $overlay = $('<div>').css({
position: 'absolute', top: 0, left: 0,
width: window.innerWidth, height: window.innerHeight,
background: 'black', opacity: 0.1})

$.fn.popover = function popover($el) {
$el.hide()
$.fn.popover = function popover() {
var $el = $(this).hide()
return function(evtOrEl) {
$el.fadeIn().click(function(evt) {evt.stopPropagation()})
.position({of: evtOrEl, offset: "0 10", collision: "fit",
Expand All @@ -20,4 +20,13 @@ define(['../src/api/jquery-1.5.1.js', '../src/api/jqueryUI/jquery-ui-1.8.14.cust
$(function() {
$overlay.prependTo('body').hide()
})
}
return {
menu: function(options) {
$el = $('<ul>')
$.each(options, function(key, value) {
// TODO: generate
})
return $el.popover()
}
}
})

0 comments on commit e6d1f82

Please sign in to comment.