This article mainly introduces the Kindeditor editor point in the picture scroll to the top of the bug related data, need friends can refer to the
Like now I'm inserting two pictures,
No matter which picture I click, the scroll bar inside will go up top.
Originally thought there would be a solution, a search results did not, and then think to go to the official website to check, but nothing, think of the official website submitted this bug, the result has no place to submit.
How to solve, if alone to solve this bug, to study the source code, I think is thankless.
Then I will be directly from Click, MouseDown these two events, find them to get the height of the place, and then feel that the words are console.log, see is not. And then I found it.
In this function
?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17-18 |
Pos:function () {var self = this, node = self[0], x = 0, y = 0; if (node) {if (node.getboundingclientrect) {var box = Node.getboundingclientrect (), pos = _getscrollpos (Self.doc); x = Box.left + pos.x; y = box.top + pos.y; else {while (node) {x + = Node.offsetleft y + = node.offsettop; node = Node.offsetparent;}}} return {x: _round (x), Y: _round (y)}; }, |
Mainly that box.top here, do not know why, the other call time is no problem, that is, click the picture when it becomes a negative number, it is estimated that it is to get img distance document height, rather than the current mouse click on the distance from the document height, or other.
So I'm going to determine if Box.top is >0 before I get Y, and then it's equal to 0. However, there is no effect. namely: box.top= box.top<0? 0:box.top;
No, I'm going to go straight to the Y=box.top + pos.y, y = (parseint (box.top) < 0? 0:box.top) +pos.y;
The bug was resolved, but there was no knowing where the problem would be. So please test more when you change. Anyway, I did not find the problem of the place, there are, remember to remind Oh. Thank you.
The above is the full content of this article, I hope to give the same needs of the small partners some help.