Skip to content
Snippets Groups Projects
Commit 67be21ac authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Fixed functionality bug for back to top button.

parent 0d1851a9
Branches
Tags
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2020-06-08 - Fixed functionality bug for back to top button.
* 2020-06-05 - Fixing broken behat step.
* 2020-06-04 - Adjusted columns2.mustache template due to upstream changes in theme Boost.
* 2020-06-04 - Making Travis happy again.
......
define ("theme_boost_campus/backtotop",["jquery","core/str"],function(a,b){"use strict";function c(){b.get_string("backtotop","theme_boost_campus").then(function(b){a("#page-footer").after("<i class=\"fa fa-chevron-up fa-2x d-print-none\"id=\"back-to-top\" aria-label=\""+b+"\"></i>")});a(window).scroll(function(){if(220<a(document).scrollTop()){a("#back-to-top").fadeIn(300)}else{a("#back-to-top").fadeOut(100)}});a("#back-to-top").click(function(b){b.preventDefault();a("html, body").animate({scrollTop:0},500)})}return{init:function init(){c()}}});
define ("theme_boost_campus/backtotop",["jquery","core/str"],function(a,b){"use strict";function c(){b.get_string("backtotop","theme_boost_campus").then(function(b){a("#page-footer").after("<i class=\"fa fa-chevron-up fa-2x d-print-none\"id=\"back-to-top\" aria-label=\""+b+"\"></i>");a(window).scroll(function(){if(220<a(document).scrollTop()){a("#back-to-top").fadeIn(300)}else{a("#back-to-top").fadeOut(100)}});a("#back-to-top").click(function(b){b.preventDefault();a("html, body").animate({scrollTop:0},500)})})}return{init:function init(){c()}}});
//# sourceMappingURL=backtotop.min.js.map
{"version":3,"sources":["../src/backtotop.js"],"names":["define","$","str","initBackToTop","get_string","then","string","after","window","scroll","document","scrollTop","fadeIn","fadeOut","click","event","preventDefault","animate","init"],"mappings":"AAyBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,UAAX,CAAD,CAAyB,SAASC,CAAT,CAAYC,CAAZ,CAAiB,CAC5C,aAKA,QAASC,CAAAA,CAAT,EAAyB,CAErBD,CAAG,CAACE,UAAJ,CAAe,WAAf,CAA4B,oBAA5B,EAAkDC,IAAlD,CAAuD,SAAUC,CAAV,CAAkB,CAErEL,CAAC,CAAC,cAAD,CAAD,CAAkBM,KAAlB,CAAwB,mFACcD,CADd,CACuB,SAD/C,CAEH,CAJD,EAQAL,CAAC,CAACO,MAAD,CAAD,CAAUC,MAAV,CAAiB,UAAW,CACxB,GAA8B,GAA1B,CAAAR,CAAC,CAACS,QAAD,CAAD,CAAYC,SAAZ,EAAJ,CAAmC,CAC/BV,CAAC,CAAC,cAAD,CAAD,CAAkBW,MAAlB,CAAyB,GAAzB,CACH,CAFD,IAEO,CACHX,CAAC,CAAC,cAAD,CAAD,CAAkBY,OAAlB,CAA0B,GAA1B,CACH,CACJ,CAND,EASAZ,CAAC,CAAC,cAAD,CAAD,CAAkBa,KAAlB,CAAwB,SAASC,CAAT,CAAgB,CACpCA,CAAK,CAACC,cAAN,GACAf,CAAC,CAAC,YAAD,CAAD,CAAgBgB,OAAhB,CAAwB,CAACN,SAAS,CAAE,CAAZ,CAAxB,CAAwC,GAAxC,CACH,CAHD,CAIH,CAED,MAAO,CACHO,IAAI,CAAE,eAAW,CACbf,CAAa,EAChB,CAHE,CAKV,CApCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code back to top button\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\n\ndefine(['jquery', 'core/str'], function($, str) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initBackToTop() {\n // Get the string backtotop from language file.\n str.get_string('backtotop', 'theme_boost_campus').then(function (string) {\n // Add a fontawesome icon after the footer as the back to top button.\n $('#page-footer').after('<i class=\"fa fa-chevron-up fa-2x d-print-none\"' +\n 'id=\"back-to-top\" aria-label=\"' + string + '\"></i>');\n });\n\n // This function fades the button in when the page is scrolled down or fades it out\n // if the user is at the top of the page.\n $(window).scroll(function() {\n if ($(document).scrollTop() > 220) {\n $('#back-to-top').fadeIn(300);\n } else {\n $('#back-to-top').fadeOut(100);\n }\n });\n\n // This function scrolls the page to top with a duration of 500ms.\n $('#back-to-top').click(function(event) {\n event.preventDefault();\n $('html, body').animate({scrollTop: 0}, 500);\n });\n }\n\n return {\n init: function() {\n initBackToTop();\n }\n };\n});\n"],"file":"backtotop.min.js"}
\ No newline at end of file
{"version":3,"sources":["../src/backtotop.js"],"names":["define","$","str","initBackToTop","get_string","then","string","after","window","scroll","document","scrollTop","fadeIn","fadeOut","click","event","preventDefault","animate","init"],"mappings":"AAyBAA,OAAM,gCAAC,CAAC,QAAD,CAAW,UAAX,CAAD,CAAyB,SAASC,CAAT,CAAYC,CAAZ,CAAiB,CAC5C,aAKA,QAASC,CAAAA,CAAT,EAAyB,CAErBD,CAAG,CAACE,UAAJ,CAAe,WAAf,CAA4B,oBAA5B,EAAkDC,IAAlD,CAAuD,SAAUC,CAAV,CAAkB,CAErEL,CAAC,CAAC,cAAD,CAAD,CAAkBM,KAAlB,CAAwB,mFACcD,CADd,CACuB,SAD/C,EAKAL,CAAC,CAACO,MAAD,CAAD,CAAUC,MAAV,CAAiB,UAAW,CACxB,GAA8B,GAA1B,CAAAR,CAAC,CAACS,QAAD,CAAD,CAAYC,SAAZ,EAAJ,CAAmC,CAC/BV,CAAC,CAAC,cAAD,CAAD,CAAkBW,MAAlB,CAAyB,GAAzB,CACH,CAFD,IAEO,CACHX,CAAC,CAAC,cAAD,CAAD,CAAkBY,OAAlB,CAA0B,GAA1B,CACH,CACJ,CAND,EASAZ,CAAC,CAAC,cAAD,CAAD,CAAkBa,KAAlB,CAAwB,SAASC,CAAT,CAAgB,CACpCA,CAAK,CAACC,cAAN,GACAf,CAAC,CAAC,YAAD,CAAD,CAAgBgB,OAAhB,CAAwB,CAACN,SAAS,CAAE,CAAZ,CAAxB,CAAwC,GAAxC,CACH,CAHD,CAIH,CApBD,CAqBH,CAED,MAAO,CACHO,IAAI,CAAE,eAAW,CACbf,CAAa,EAChB,CAHE,CAKV,CApCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Theme Boost Campus - JS code back to top button\n *\n * @package theme_boost_campus\n * @copyright 2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n\n\ndefine(['jquery', 'core/str'], function($, str) {\n \"use strict\";\n\n /**\n * Initialising.\n */\n function initBackToTop() {\n // Get the string backtotop from language file.\n str.get_string('backtotop', 'theme_boost_campus').then(function (string) {\n // Add a fontawesome icon after the footer as the back to top button.\n $('#page-footer').after('<i class=\"fa fa-chevron-up fa-2x d-print-none\"' +\n 'id=\"back-to-top\" aria-label=\"' + string + '\"></i>');\n\n // This function fades the button in when the page is scrolled down or fades it out\n // if the user is at the top of the page.\n $(window).scroll(function() {\n if ($(document).scrollTop() > 220) {\n $('#back-to-top').fadeIn(300);\n } else {\n $('#back-to-top').fadeOut(100);\n }\n });\n\n // This function scrolls the page to top with a duration of 500ms.\n $('#back-to-top').click(function(event) {\n event.preventDefault();\n $('html, body').animate({scrollTop: 0}, 500);\n });\n });\n }\n\n return {\n init: function() {\n initBackToTop();\n }\n };\n});\n"],"file":"backtotop.min.js"}
\ No newline at end of file
......@@ -35,7 +35,6 @@ define(['jquery', 'core/str'], function($, str) {
// Add a fontawesome icon after the footer as the back to top button.
$('#page-footer').after('<i class="fa fa-chevron-up fa-2x d-print-none"' +
'id="back-to-top" aria-label="' + string + '"></i>');
});
// This function fades the button in when the page is scrolled down or fades it out
// if the user is at the top of the page.
......@@ -52,6 +51,7 @@ define(['jquery', 'core/str'], function($, str) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 500);
});
});
}
return {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment