JQuery - Position() in Hindi




JQuery position() method आपको मूल तत्व के सापेक्ष किसी तत्व की current event को प्राप्त करने में सक्षम बनाता है यह पहले मिलान वाले तत्व की event देता है इस विधि में वस्तु के दो गुणों है जो पिक्सल में शीर्ष और बाएं स्थितियों का representation करते हैं

JQuery position() method JQuery में छुपा हुए तत्वों event निर्देशांक को प्राप्त करने या html दस्तावेज़ तत्व पर सेट मार्जिन के लेखा का समर्थन नहीं करता है यह केवल visible तत्वों के लिए लागू होता है इसका मतलब है, की आप दृश्यता वाले तत्वों की स्थिति को प्राप्त कर सकते हैं: छिपा हुआ; लेकिन प्रदर्शन के साथ नहीं

JQuery position() method हमें offset माता पिता के सापेक्ष किसी तत्व की वर्तमान event विशेष रूप से उसके margin बॉक्स को Recover करने की अनुमति देता है जब दूसरे तत्व के पास एक नया तत्व और उसमें DOM तत्व मौजूद हो, तो event () अधिक उपयोगी होती है।

Example Code

<!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(){
        var x = $("p").position();
        alert("Top position: " + x.top + " Left position: " + x.left);
    });
});
</script>
</head>
<body>

<p>This My Paragraph.</p>
<button>Click here to return the top and left position of the p element</button>

</body>
</html>

Example Result

This My Paragraph.