sped up scroll bars

This commit is contained in:
Connor Turland 2014-06-10 13:34:39 -04:00
parent b7703e2a0f
commit bfa25bc604
6 changed files with 38 additions and 19 deletions

View file

@ -45,7 +45,7 @@ function buildCardWithHogan(node) {
nodeValues.synapse_count = node.getData("synapseCount");
nodeValues.id = node.id;
nodeValues.metacode = node.getData("metacode");
nodeValues.metacode_class = 'mbg' + node.getData("metacode").replace(/\s/g,'');
nodeValues.metacode_class = 'mbg' + node.getData("metacode").replace(/\s/g, '');
nodeValues.imgsrc = imgArray[node.getData("metacode")].src;
nodeValues.name = node.name;
nodeValues.userid = node.getData("userid");
@ -127,7 +127,12 @@ function populateShowCard(node) {
$('.metacodeSelect').show();
// add the scroll bar to the list of metacode select options if it isn't already there
if (!$('.metacodeSelect ul').hasClass('mCustomScrollbar')) {
$('.metacodeSelect ul').mCustomScrollbar();
$('.metacodeSelect ul').mCustomScrollbar({
mouseWheelPixels: 200,
advanced: {
updateOnContentResize: true
}
});
$('.metacodeSelect li').click(function () {
selectingMetacode = false;

View file

@ -148,7 +148,7 @@ function updateMetacode(node, metacode) {
data: mdata,
success: function (data) {
$('.CardOnGraph').find('.metacodeTitle').text(metacode)
.attr('class', 'metacodeTitle mbg' + metacode.replace(/\s/g,''));
.attr('class', 'metacodeTitle mbg' + metacode.replace(/\s/g, ''));
$('.CardOnGraph').find('.metacodeImage').css('background-image', 'url(' + imgArray[metacode].src + ')');
node.setData("metacode", metacode);
Mconsole.plot();
@ -231,16 +231,16 @@ function updateMapPermission(mapid, permission) {
}
function updateMetacodeSet(set, index, custom) {
if (custom && MetamapsModel.newSelectedMetacodes.length == 0) {
alert('Please select at least one metacode to use!');
return false;
}
var codesToSwitchTo;
MetamapsModel.selectedMetacodeSetIndex = index;
MetamapsModel.selectedMetacodeSet = "metacodeset-" + set;
if (!custom) {
codesToSwitchTo = $('#metacodeSwitchTabs' + set).attr('data-metacodes').split(',');
$('.customMetacodeList li').addClass('toggledOff');
@ -259,7 +259,7 @@ function updateMetacodeSet(set, index, custom) {
// sort by name
codesToSwitchTo.sort();
codesToSwitchTo.reverse();
$('#metacodeImg, #metacodeImgTitle').empty();
$('#metacodeImg').removeData('cloudcarousel');
var newMetacodes = "";
@ -275,7 +275,7 @@ function updateMetacodeSet(set, index, custom) {
mouseWheel: true,
bringToFront: true
});
$('#lightbox_overlay').hide();
$('#topic_name').focus();
@ -305,8 +305,7 @@ function cancelMetacodeSetSwitch() {
MetamapsModel.selectedMetacodeNames = [];
MetamapsModel.newSelectedMetacodes = [];
MetamapsModel.newSelectedMetacodeNames = [];
}
else { // custom set is selected
} else { // custom set is selected
// reset it to the current actual selection
$('.customMetacodeList li').addClass('toggledOff');
for (var i = 0; i < MetamapsModel.selectedMetacodes.length; i++) {
@ -337,7 +336,12 @@ function openNodeShowcard(node) {
$('.showcard').fadeIn('fast');
var s = $('.showcard').find('.scroll');
s.height(s.height()).mCustomScrollbar();
s.height(s.height()).mCustomScrollbar({
mouseWheelPixels: 200,
advanced: {
updateOnContentResize: true
}
});
MetamapsModel.showcardInUse = node.id;
}
@ -347,9 +351,14 @@ function openLightbox(which) {
$('#lightbox_overlay').show();
$('#lightbox_main').css('margin-top', '-' + ($('#lightbox_main').height() / 2) + 'px');
if (!MetamapsModel.metacodeScrollerInit) {
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({advanced: { updateOnContentResize: true }});
$('.customMetacodeList, .metacodeSetList').mCustomScrollbar({
mouseWheelPixels: 200,
advanced: {
updateOnContentResize: true
}
});
MetamapsModel.metacodeScrollerInit = true;
}
if (which == "switchMetacodes") {
@ -383,5 +392,4 @@ function cancelMapCreate(id) {
form.find('.mapCommonsIcon').addClass('selected');
return false;
}
}

View file

@ -76,6 +76,7 @@ $(document).ready(function () {
// initialize scroll bar for filter by metacode, then hide it and position it correctly again
$("#filter_by_metacode").mCustomScrollbar({
mouseWheelPixels: 200,
advanced: {
updateOnContentResize: true
}

View file

@ -1764,7 +1764,7 @@ div.mapInfoStat {
list-style-type: none;
display: block;
padding: 0px;
width: 93px;
width: 92px;
height: 70px;
float: left;
text-align: center;

View file

@ -60,7 +60,12 @@
<script>
$(document).ready(function() {
$('.FAQ').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar();
$('.FAQ').height( (parseInt($('body').height()) - 40) ).mCustomScrollbar({
mouseWheelPixels: 200,
advanced: {
updateOnContentResize: true
}
});
$('.FAQ .question').click(function() {

View file

@ -10,7 +10,7 @@
<div class="mapCard">
<div class="mapPerm <%= map.mk_permission %>"></div>
<span class="title">
<%= best_in_place map, :name, :type => :input, :classes => 'best_in_place_name' %>
<%= map.name %>
</span>
<div class="mapContains">
<span class="topicCount"><%= pluralize(map.topics.count, 'topic') %></span>
@ -19,7 +19,7 @@
<div class="littleOverlay">
<div class="scroll">
<div class="desc">
<%= best_in_place map, :desc, :type => :textarea, :nil => "<span class='gray'>Click to add description.</span>", :classes => 'best_in_place_desc' %>
<%= map.desc %>
</div>
</div>
<span><%= pluralize(map.contributors.count, 'contributor') %></span><span>Last edit <%= time_ago_in_words( map.updated_at ) %> ago</span>