Wednesday, January 9, 2019

Region Image Show and Zoom in or out in oracle apex

1. Create a Blank Page 
2. Create first Region Name Image Browse & Create a Item P22_Image & Type File Browse.
3. Create second Region Name Image Show
4. Go Page HTML HEADER &Paste[This code reading the url where u browse image] JavaScript Function

<script>
function readURL(input) {
 if (input.files && input.files[0])
 {
 var reader=new FileReader();
 reader.onload = function(e){
 $('#myImg')
 .attr('src',e.target.result);
 };
 reader.readAsDataURL(input.files[0]);
 }
}

</script>

5. Go to second region Image Show and find out SOURCE option TEXT.  here write the code.
This code is for show the image with  zoom and zoom out. here is two javascript function and two class of css.


<head>
<script>

function zoom(){
 var divlClass=$('#myDiv').attr('class');
 if (divlClass==="ex"){
 $('#myDiv').css('cursor','zoom-in');}else
 if ( divlClass=== "exZoom" ) {
 $('#myDiv').css('cursor','zoom-out');}
 }


function my_class(){
 var divlClass= $('#myDiv').attr('class');
 if(divlClass=== "ex"){
 $("#myDiv").removeClass("ex");
 $("#myImg").removeClass("ex");
 $("#myDiv").addClass("exZoom");
 $("#myImg").addClass("exZoom");} else
 if(divlClass==="exZoom"){
 $("#myDiv").removeClass("exZoom");
 $("#myImg").removeClass("exZoom");
 $("#myDiv").addClass("ex");
 $("#myImg").addClass("ex");}
 }
 </script>

    <style>
    .ex
    {
    height:120px ;
    width:150px;
    padding:2px ;
    }
    .exZoom
    {
    height:1000px;
    width:1000px;
    padding:0px;
    }

    </style>
    </head>
    <div align="center">
    <div id="myDiv" class="ex">
    <img id="myImg" class="ex" onmouseover="zoom();" onClick="my_class(); zoom();" src="#" alt="" />

    </div> </div>

6. Go to the first region and the item P22_Image Click on the item and Find     out CUSTOM ATTRIBUTE and write the code.

onchange="readURL(this);" onload="readURL(this);"

No comments:

Post a Comment

To generate a PDF using JavaScript in Oracle APEX from a collection

  To generate a PDF using JavaScript in Oracle APEX from a collection, you can follow these steps: 1. Create a button or link on your APEX p...