Commit d72d0327 authored by Kjetil Thuen's avatar Kjetil Thuen

Prevent reselect of already selected element.

This solves lots of problems in lots of different browsers
parent 6554eabf
......@@ -30,7 +30,6 @@
$.ajax({
url: "https://nesstar-dev.nsd.uib.no/nesstardrop/study/list",
datatype: "json",
async: true,
context: document.body
}).done(function(data) {
jsondata = data;
......
......@@ -57,6 +57,7 @@ ul#studies_list li.selected {
h2 {
margin: 0px;
padding: 0.5em;
z-index: 3;
}
h2#target {
......
......@@ -14,8 +14,6 @@ var initialize_list_peek = function() {
};
var register_event_handlers = function() {
// $(window).on("touchend", set_selected_element);
//document.onscroll = debounce(find_and_select_element, 250, false);
jQuery(window).bind('scrollstart', function(){
console.log("scrollstart");
$('#expander:visible').slideUp();
......@@ -69,13 +67,14 @@ var set_selected_element = function (element) {
if (!element) {
element = $('#studies_list li:first-child').get();
}
$('#expander:visible').slideUp();
$('ul#studies_list li').removeClass("selected");
if (element) {
var listElem = $(element).closest('li');
currently_selected_element = listElem;
if (listElem.is("LI")) {
if (listElem.is("LI") && listElem !== currently_selected_element) {
$('#expander:visible').slideUp();
$('ul#studies_list li').removeClass("selected");
currently_selected_element = listElem;
listElem.addClass('selected');
scrollVal = listElem.offset().top - $('#studies_list').position().top;
debounce(show_expanded_info, 500, false)();
......
Markdown is supported
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