MOON
Server: Apache
System: Linux e2e-78-16.ssdcloudindia.net 3.10.0-1160.45.1.el7.x86_64 #1 SMP Wed Oct 13 17:20:51 UTC 2021 x86_64
User: imensosw (1005)
PHP: 8.0.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/imensosw/public_html/imenso.co/dev/iframe/index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Detect Click into iFrame</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<style>
    body{
        padding: 30px;
    }
    iframe{
        width: 100%;
        height: 1100px;
        border: 2px solid #ccc;
    }
</style>
<script>
$(document).ready(function(){

    $("iframe").load(function(){
       // $(this).contents().on("mousedown, mouseup, click", function(){
        //    alert("Click detected inside iframe.");
       // });
        $(this).contents().on('click1', function(e){
        	           // alert("Click detected inside iframe.");
        $(this).scrollTop(880);
        e.preventDefault();
        $('html, body').animate({
            scrollTop : $(this.hash).offset().top
        }, 500);
    });
    });
    var myIframe = document.getElementById('iframe');
    $(document).on('click','a',function(){
         var href=$(this).attr('href');

            var test= $('body').find('iframe').contents().find(href).offset().top;
            
            ///alert(test);
             myIframe.contentWindow.scrollTo({ top: test, behavior: 'smooth' });
      

    })
});
</script>
</head>
<body>
	<a href="#new0">About</a> <br>
    <a href="#new">ContectUs</a>
    <iframe id="iframe" height="100%" width="100%" src="dashboard/faq.html"></iframe>

   
    </script>
</body>
</html>