Ticket #1010 (closed defect: invalid)
Clicking left/right of the knob of Slider broken in beta 1.2r2 when in relative positioned div
| Reported by: | sasoj | Owned by: | |
|---|---|---|---|
| Type: | defect | Priority: | major |
| Milestone: | Mootools version 1.2 | Component: | Plugins |
| Keywords: | Slider Click | Cc: |
Description
Tested in browsers: IE7 and Firefox 3.0b5
When clicking left or right of the slider knob, the knob is not positioned properly. Seems like it is offset by the distance from the left edge of the div to left edge of the window.
The functionality worked properly in version 1.1.
I made a quick patch for myself that seems to fix the problem:
The following line from the clickedElement function was changed from
var position = event.page[this.axis] - this.element.getRelativePosition()[this.axis] - this.half;
To
var position = event.page[this.axis] - this.element.getPosition()[this.axis] - this.half;
This is a simple page that can be used to test the problem:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="cs" lang="cs">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>
Untitled Page
</title>
<script src="mootools-beta-1.2b2.js" type="text/javascript"></script>
</head>
<body>
<div style="margin:auto;width:400px">
<div style="position:relative;width:300px;left:50px">
<script type="text/javascript">
window.addEvent('domready', function()
{var mySlide2 = new Slider($('area2'), $('knob2'), {steps: 12});});
</script>
<div id="area2" style="background-color:Aqua;width:300px;height:20px">
<div id="knob2" style="background-color:Black;width:12px;height:20px"></div>
</div>
</div>
</div>
</body>
</html>
Change History
Note: See
TracTickets for help on using
tickets.