JSFiddle - React, Tailwind, and code Playground
HTML
<div id="container" >
<div id="scale">Toggle Scale!</div>
<div id="click">I wanna click!</div>
<div id="click2">I wanna click2!</div>
<div id="offset">
</div>
</div>
CSS
#container {
width: 300px;
height: 300px;
position: relative;
}
.scaleLevel1 {
-webkit-transform: scale(1.4);
-moz-transform: scale(1.4);
-ms-transform: scale(1.4);
-o-transform: scale(1.4);
transform: scale(1.4);
}
#offset {
position: absolute; background: red; height: 20px; width:20px;
}
#click {
position: absolute;
right: 0;
top: 30px;
height: 40px;
width: 100px;
background: green;
}
#click2 {
position: absolute;
right: 0;
top: 100px;
height: 40px;
width: 100px;
background: green;
}
JavaScript
$(document).on('click', '#click', function() {
$('#offset').offset($('#click').offset());
});
$(document).on('click', '#click2', function() {
$('#offset').offset($('#click2').offset());
});
$(document).on('click', '#scale', function() {
$('#container').toggleClass('scaleLevel1');
$('#container').offset({top: 0, left: 0});
});