Commit a0345423 authored by Dave Lane's avatar Dave Lane
Browse files

enhancing touch behaviour to close popup if tapped

parent 1ab5c27e
......@@ -68,10 +68,12 @@ abstract class BFFFinder extends BFFFeed {
if ($this->find_feed_in_page($url)) {
$this->log('found a feed reference in the page content!');
// look for a feed referenced in the page
$this->response['valid_url'] = $url;
$succeeded = true;
} else if ($this->find_feed_in_usual_places($url)) {
// look for feeds in the normal places
$this->log('looking for a feed in the usual places');
$this->response['valid_url'] = $url;
$succeeded = true;
} else {
$this->log('failed to find a feed at: '. $url);
......
......@@ -150,9 +150,10 @@ jQuery(document).ready(function() {
* initialise jquery tooltips with custom functionality
* credit for this: https://gist.github.com/csasbach/867744
*/
function enable_tooltips() {
var tooltip = '.bff-tooltip'; // trigger for popup content
var popup = 'bff-popup'; // the actual popup class
function enable_tooltips() {
// popup display offsets
var voffset = 6;
var hoffset = 6;
......@@ -181,6 +182,7 @@ jQuery(document).ready(function() {
var top = $(this).position().top-voffset;
$(this).next().css('left',left);
$(this).next().css('top',top);
enable_popup();
});
// manage clicks, e.g. from touch devices
$(tooltip).click(function() {
......@@ -196,9 +198,19 @@ jQuery(document).ready(function() {
console.log('mouseout');
$(this).next('.'+popup).remove();
});
});
}
function enable_popup() {
console.log('enabling popup');
$('.'+popup).each(function() {
// if the user explicitly clicks on a popup
$('.'+popup).click(function() {
console.log('click on popup');
$(this).remove();
});
});
}
/*
* end tooltip stuff
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment