Bug on top of picture scroll bar in Kindeditor editor point

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.