Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function scrollToIFrame #115

Closed
ulriklystbaek opened this issue Nov 18, 2014 · 7 comments
Closed

Function scrollToIFrame #115

ulriklystbaek opened this issue Nov 18, 2014 · 7 comments

Comments

@ulriklystbaek
Copy link

I think a very nice feature could be scrollToIFrame, where the scroll in the parent is relative to the iframe, it may be more usefull than scrollTo, because scrolling the parent is often when you want to highlight something in the iframe.

I have added it manually to your latest min version, I wont post the sourcecode because it is so trivial, it is just the scrollTo function but adding the iframes offset top. I would make a change request, but I ran into an issue where you use width and height to transfer the scroll values, and they do not accept negative values by default (in case you want to scroll like 10px above the iframe it is -10), and I just fixed this pretty dirty by changed minHeight to 1/0, you would probably like a more correct solution.

@davidjbradshaw
Copy link
Owner

Rather than change the current function, it would make more sense to create a new one called scrollToOffset. So people have the option of which one to use. Happy to take a pull request if you want to do that, but please also include a test.

@ulriklystbaek
Copy link
Author

Yes it was also my intent to create another version of the existing function. I will try to find some time to implement it.

@davidjbradshaw
Copy link
Owner

Thanks. I also think that the min/max height checks acting on these values is a bug. That check should be disabled for scrollTo().

@davidjbradshaw
Copy link
Owner

Just had a look at the code. I'm going to move these lines

ensureInRange('Height');
ensureInRange('Width');

So they are only called if we are resizing the iFrame.

@ulriklystbaek
Copy link
Author

Great it would make it really easy to implement.

@davidjbradshaw
Copy link
Owner

OK fix released as v2.6.3

@davidjbradshaw
Copy link
Owner

Added scrollToOffset() method in v.2.6.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants