bullet03 commented on code in PR #17638:
URL: https://github.com/apache/beam/pull/17638#discussion_r879057657
##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -89,7 +104,11 @@ $(document).ready(function() {
$("." + _self.wrapper + " ul li").click(function(el) {
// Making type preferences presistance, for user.
localStorage.setItem(_self.dbKey, $(this).data("type"));
+
+ // Set scroll to new position because Safari and Firefox
can't do it automatically, only Chrome under the good detects the correct
position of viewport
Review Comment:
done
##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
// License for the specific language governing permissions and limitations
under
// the License.
+function getElPreviousPositionAndData(el) {
Review Comment:
done
##########
website/www/site/assets/js/language-switch-v2.js:
##########
@@ -10,11 +10,26 @@
// License for the specific language governing permissions and limitations
under
// the License.
+function getElPreviousPositionAndData(el) {
+ const clickedLangSwitchEl = el.target.closest(".language-switcher");
+ const elPreviousOffsetFromViewPort =
clickedLangSwitchEl.getBoundingClientRect().top;
+ return {
+ elPreviousOffsetFromViewPort,
+ clickedLangSwitchEl,
+ }
+}
+
+function setScrollToNewPosition(clickedElData) {
+ const { elPreviousOffsetFromViewPort, clickedLangSwitchEl } =
clickedElData;
+ const elCurrentHeight = window.pageYOffset +
clickedLangSwitchEl.getBoundingClientRect().top;
+ $('html, body').scrollTop(elCurrentHeight - elPreviousOffsetFromViewPort);
+}
+
$(document).ready(function() {
function Switcher(conf) {
var id = conf["class-prefix"],
- def = conf["default"],
- langs = [];
+ def = conf["default"],
Review Comment:
done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]