I've added the additional class to the iframe: ''komunikat1".
My iframe has following structure:
But unfortunately console in Mozilla show:
"myiframe is undefined"
I've also tried run this function after the document is ready
but unfortunately the result is the same.
I've tried but I have this(something but probably not exactly "blok"):
My iframe has following structure:
Code:
-- Create HTML content
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Darmowy Kurs CSS</title>
<style>
#blok {
position:relative;
width:660px;
height:80px;
line-height:80px;
margin:0 auto;
<!-- border:3px solid #DDD;
border-color: #787878;
border-radius: 10px; -->
font-family:sans-serif;
font-size:50px;
font-weight:bold;
color: white;
background-color:]] .. color .. [[;
overflow:hidden;
}
#blok > p {
position:absolute;
margin:0;
white-space:nowrap;
animation:przesun 20s linear infinite;
-webkit-animation:przesun 20s linear infinite; /* dla Google Chrome, Safari, Opera 15+ */
}
#blok > p:hover {
animation-play-state:paused;
-webkit-animation-play-state:paused;
}
/* ------------ANIMACJA-PRZESUN------------ */
@keyframes przesun
{
0% { transform:translateX(0); padding-left:110%; }
100% { transform:translateX(-100%); padding-left:110%; }
}
@-webkit-keyframes przesun /* dla Google Chrome, Safari, Opera 15+ */
{
0% { -webkit-transform:translateX(0); padding-left:110%; }
100% { -webkit-transform:translateX(-100%); padding-left:110%; }
}
</style>
</head>
<body>
<div id="blok">
<p>tekst</p>
</div>
</body>
</html>]]
But unfortunately console in Mozilla show:
"myiframe is undefined"
I've also tried run this function after the document is ready
Code:
$(function(){
$( document ).ready(function() {
var myiframe = document.getElementsByClassName("komunikat1")[0];
var myiframeelement = myiframe.contentWindow.document.getElementById('blok')
console.log(myiframeelement)
});
});
but unfortunately the result is the same.
I've tried but I have this(something but probably not exactly "blok"):