iFrame src Through url to Condition Div Show and Hide jQuery

If you want to iframe url to through show/display and hide any div class on any page and template. you have specific iframe src link of any page, you can iframes url base to condition for div class show and hide on any pages.

iFrame url to through div show and hide on page and template

We have developed custom code for iframe url to through div class show/display and hide on page, Use this below iframe url base code for condition match url on iframe src code.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
<script>
jQuery(document).ready(function() {
var myurl = 'https://example.com';
var currentURL = document.getElementById("iframe-login").src;
if(myurl == currentURL) {
jQuery('#logout-menu').hide();
}
else{
jQuery('#logout-menu').show();
}
});
</script>


Below html iframe src code, you can use this one code on your page and template file.

<iframe id="iframe-login" name="" src="https://example.com" width="100%" height="500"></iframe>

Post a Comment

0 Comments