- Posts: 17
COMMUNITY FORUM
- Forum
- K2 Community Forum
- English K2 Community
- Magnific Popup Iframe - How to show that the iframe is loadi
Magnific Popup Iframe - How to show that the iframe is loadi
- Niels Klint
-
Topic Author
- Offline
- New Member
- Learning by doing
Less
More
8 years 11 months ago - 8 years 11 months ago #154140
by Niels Klint
Magnific Popup Iframe - How to show that the iframe is loadi was created by Niels Klint
Is there a way to make the iframe show a loading message or animation until the content arrives?
I this case the site I want to view in the iframe is loading very slowly
Joomla 3.5.1
PHP 7
K2 v2.7.1 [Dev Build]
Site here...
I tried the solution on stackoverflow here...
But I'm not sure i understand, how to do it right
I've tried to add the following scripts - only one at a time, and both to the template body, head and the K2 item override.and thisThe last returns an error in chrome - Uncaught SyntaxError: Unexpected token (
Can You help?
I this case the site I want to view in the iframe is loading very slowly
Joomla 3.5.1
PHP 7
K2 v2.7.1 [Dev Build]
Site here...
I tried the solution on stackoverflow here...
But I'm not sure i understand, how to do it right
I've tried to add the following scripts - only one at a time, and both to the template body, head and the K2 item override.
<script type="text/javascript">
callbacks: {
beforeAppend: showIframeLoading
}
var showIframeLoading = function() {
var curLength = 0;
var interval = setInterval(function() {
if ($('iframe').length !== curLength) {
curLength = $('.column-header').length;
$('.mfp-content').hide();
$('.mfp-preloader').show();
}
}, 50);
this.content.find('iframe').on('load', function() {
clearInterval(interval);
$('.mfp-content').show();
$('.mfp-preloader').hide();
});
};
</script>
<script type="text/javascript">
callbacks: {
beforeAppend: function() {
console.log('before iframe is added to DOM');
this.content.find('iframe').on('load', function() {
console.log('iframe loaded');
});
}
}
var showIframeLoading = function() {
var curLength = 0;
var interval = setInterval(function() {
if ($('iframe').length !== curLength) {
curLength = $('.column-header').length;
$('.mfp-content').hide();
$('.mfp-preloader').show();
}
}, 50);
this.content.find('iframe').on('load', function() {
clearInterval(interval);
$('.mfp-content').show();
$('.mfp-preloader').hide();
});
};
</script>
Can You help?
Last edit: 8 years 11 months ago by Niels Klint.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- User
Less
More
8 years 11 months ago #154165
by Krikor Boghossian
Replied by Krikor Boghossian on topic Magnific Popup Iframe - How to show that the iframe is loadi
This means that you are closing the ) sign too early.
Perhaps you are not closing a function properly }.
In the link you sent us, you are using Fresco and I cannot find any issues.
Perhaps you are not closing a function properly }.
In the link you sent us, you are using Fresco and I cannot find any issues.
Please Log in or Create an account to join the conversation.
- Niels Klint
-
Topic Author
- Offline
- New Member
- Learning by doing
Less
More
- Posts: 17
8 years 11 months ago #154205
by Niels Klint
Replied by Niels Klint on topic Magnific Popup Iframe - How to show that the iframe is loadi
Thanks for the comment, but java is not one of my disciplines, so I did find another solution with some CSS i the template custom.css
I changed the iframe background from #000 (black) to transparent and added a couple of :before tags to display my own load text and animation
I changed the iframe background from #000 (black) to transparent and added a couple of :before tags to display my own load text and animation
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- User
Less
More
8 years 11 months ago #154255
by Krikor Boghossian
Replied by Krikor Boghossian on topic Magnific Popup Iframe - How to show that the iframe is loadi
Nice to hear that issue has been resolved Niels.
Please Log in or Create an account to join the conversation.
- Forum
- K2 Community Forum
- English K2 Community
- Magnific Popup Iframe - How to show that the iframe is loadi