25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 

31 satır
974 B

  1. var IframeOnClick = {
  2. resolution: 200,
  3. iframes: [],
  4. interval: null,
  5. Iframe: function () {
  6. this.element = arguments[0];
  7. this.cb = arguments[1];
  8. },
  9. track: function (element, cb) {
  10. this.iframes.push(new this.Iframe(element, cb));
  11. var _this = this;
  12. this.interval = setInterval(function () {
  13. _this.checkClick();
  14. }, this.resolution);
  15. },
  16. checkClick: function () {
  17. if (document.activeElement) {
  18. var activeElement = document.activeElement;
  19. for (var i in this.iframes) {
  20. if (activeElement === this.iframes[i].element) { // user is in this Iframe
  21. this.iframes[i].cb.apply(window, []);
  22. var btn = document.getElementById("btn")
  23. btn.focus()
  24. }
  25. }
  26. }
  27. }
  28. };
  29. IframeOnClick.track(document.getElementById("iFrame"), function () {
  30. console.log(11111);
  31. });