Set the offset using an object - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:offset

Description

Set the offset using an object

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("p").offset({top: 200, left: 200});
    });/*  w w  w  .  j  a v a2s.  co m*/
});
</script>
</head>
<body>

<p>This is a paragraph.</p>

<button>Set the offset coordinates of the p element</button>

</body>
</html>

Related Tutorials