About the top of the scroll bar when you click a picture in Kindeditor

Source: Internet
Author: User

Like now I'm inserting two pictures,

No matter which picture I click, the scroll bar inside will top up.

Originally thought that there will be a solution, a search results did not, and then think about the official website to check, but nothing, think of the official website to submit this bug, the results have no place to submit.

How to solve, if only to solve this bug, to study the source code, I feel is thankless.

Then I go straight from the click, MouseDown these two events, find them to get the height of the place, and then feel the words are console.log under, see is not. And then we found it.

In this function.

Pos:function () {
var = 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)};
},

The main is that box.top here, do not know why, other calls when it is not a problem, that is, click on the picture when it becomes negative, it is estimated that it is to obtain an IMG from the height of the document, rather than the current mouse click where the height of the document, 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, it has no effect. namely: box.top= box.top<0? 0:box.top;

No, I'll just go straight to Y=box.top + pos.y, y = (parseint (box.top) < 0? 0:box.top) +pos.y;

This bug was resolved, but I don't know where the problem is. So when you change it, please test it more. Anyway, I did not find the problem of the place, there are, remember to remind Oh. Thank you.

About the top of the scroll bar when you click a picture in Kindeditor

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.