2

I have a script that works well on the page. when I connect it via iframe, jQuery functions do not work, but everything is written out the usual script.

$.noConflict (); does not help

danwellman
  • 9,068
  • 8
  • 60
  • 88

2 Answers2

0

Unsure entirely what you mean by 'jQuery functions do not work'.

If you mean that you cannot access the elements inside the iframe using jQuery, you should be able to access them using the contents() method, see this answer

If the iframe comes from another domain, the browser will restrict script access to the contents based on the browser's same-origin policy, although you may still be able to access the content using postMessage, see this answer about that

Community
  • 1
  • 1
danwellman
  • 9,068
  • 8
  • 60
  • 88
0

Thank you for helping some of the links led me to the right answer. had iframe prescribe ID and using $ ( "iframe"). load (function (e) {} solve the problem. However, remained one more thing that I can improve. I at still function onWheel (e) {} and I can not rewrite it so that it worked ...

function onWheel(e) {     // podia na skroll
    e = e || window.event;
    delta = e.deltaY || e.detail || e.wheelDelta;
    var info = $('#delta');
    info.innerHTML = +info.innerHTML + (delta * (-1));
    e.preventDefault ? e.preventDefault() : (e.returnValue = false);
    sliderValue = parseInt($("#delta").html());
    $("#amount").val(sliderValue);

    calculationScale(); 
    repaintingSlider(); 
}
  • Sure, no problem, I think you should ask this second part as a new question, because I can only answer your second part with either a new answer (which isn't right as it looks like an answer to the original question), or with a comment, and code doesn't look as good in a comment :) – danwellman Oct 11 '16 at 15:09
  • http://stackoverflow.com/questions/39981713/questions-with-jqery-in-iframe-part-2 – Дмитро Синятинський Oct 11 '16 at 16:03