EragonJ / Trip.js

🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
https://eragonj.github.io/Trip.js/
MIT License
793 stars 111 forks source link

Support for targeting elements in iframes #188

Closed digitalillusion closed 7 years ago

digitalillusion commented 7 years ago

jquery allows to write a selector which targets elements inside an iframe, and this can be passed to Trip.js However, the library does not behave correctly in such case. The PR introduces two methods to get the left and top offset of an element inside an iframe. The methods are used to scroll in place and to correctly position the $tripBlock. A lightweight check is performed to verify if the element is indeed inside an iframe, so performance is not degraded by the new feature

EragonJ commented 7 years ago

@digitalillusion didn't notice this PR, sorry~ (I was on New Year vacation here in Taiwan :P) I'll check that in these few days. BTW, if possible, can you try to write a test case for it ? Just verify the position can be correctly calculated and it's enough :) Big Thanks again

digitalillusion commented 7 years ago

@EragonJ I added some tests, they only work in firefox (not in chrome) due to different policy considering localhost as a cross domain request.

EragonJ commented 7 years ago

@digitalillusion thanks !!