MediaWiki:Common.js

From Haven Homes
Revision as of 10:09, 6 November 2023 by Chris (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

var panoContainer = document.getElementById('panorama');
var panoImage = document.getElementById('panoImage');

var isPanning = false;
var startX = 0;
var scrollLeft = 0;

panoContainer.addEventListener('mousedown', function(e) {
  isPanning = true;
  startX = e.pageX - panoContainer.offsetLeft;
  scrollLeft = panoContainer.scrollLeft;
  panoContainer.style.cursor = 'grabbing';
});

panoContainer.addEventListener('mouseleave', function() {
  isPanning = false;
  panoContainer.style.cursor = 'grab';
});

panoContainer.addEventListener('mouseup', function() {
  isPanning = false;
  panoContainer.style.cursor = 'grab';
});

panoContainer.addEventListener('mousemove', function(e) {
  if (!isPanning) return;
  e.preventDefault();
  var x = e.pageX - panoContainer.offsetLeft;
  var walk = x - startX;
  panoContainer.scrollLeft = scrollLeft - walk;
});
This site is in the process of being built; content may not be accurate or complete. Please contact us if you see an error.
No AI or LLM tools were used to generate any text or images on this site. If they had been, the site would be complete and look better.