This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Javascript mouse click event
#4
Something to start with Smile

CSS
Code:
.menu {
  z-index: 1000;
}

.overlay-left {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 200px;
  background-color: red;
  z-index: 999;
}

.overlay-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 200px;
  background-color: blue;
  z-index: 999;
}

JavaScript
Code:
$(function(){
  var body = $(document.body), el;

  // only apply script to user mode visualization
  if (!body.hasClass('usermode')) {
    return;
  }

  // create overlay element
  el = $('<div></div>').addClass('overlay-left').appendTo(body);
  el.on('vclick', function() {
    alert('clicked left');
  });

  // create overlay element
  el = $('<div></div>').addClass('overlay-right').appendTo(body);
  el.on('vclick', function() {
    alert('clicked right');
  });
});
Reply


Messages In This Thread
Javascript mouse click event - by Mirco - 02.11.2016, 08:33
RE: Javascript mouse click event - by admin - 02.11.2016, 09:13
RE: Javascript mouse click event - by Mirco - 02.11.2016, 09:44
RE: Javascript mouse click event - by admin - 02.11.2016, 09:48
RE: Javascript mouse click event - by Mirco - 02.11.2016, 10:38
RE: Javascript mouse click event - by admin - 02.11.2016, 11:20
RE: Javascript mouse click event - by Mirco - 02.11.2016, 12:23
RE: Javascript mouse click event - by admin - 21.11.2016, 08:18

Forum Jump: