ui.root.onResize
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह कुकी, एक कॉलबैक रजिस्टर करती है. यह कॉलबैक तब ट्रिगर होता है, जब स्क्रिप्ट शुरू होती है और जब भी ब्राउज़र विंडो का साइज़ बदलता है. इसे एक ऑब्जेक्ट पास किया जाएगा. इसमें बूलियन फ़ील्ड "is_mobile", "is_tablet", "is_desktop", "is_portrait", और "is_landscape" के साथ-साथ संख्या वाले फ़ील्ड "width" और "height" शामिल होंगे.
इन फ़ील्ड से पता चलता है कि उपयोगकर्ता का डिवाइस मोबाइल, टैबलेट या डेस्कटॉप है या नहीं. साथ ही, डिवाइस का ओरिएंटेशन (पोर्ट्रेट या लैंडस्केप) और विंडो की चौड़ाई और ऊंचाई पिक्सल में है या नहीं. https://material.io/resources/devices/ पर जाकर, डिवाइस की मेट्रिक में चौड़ाई और ऊंचाई (डीपी) सेक्शन देखें.
इस्तेमाल | रिटर्न |
---|
ui.root.onResize(callback) | |
आर्ग्यूमेंट | टाइप | विवरण |
---|
callback | फ़ंक्शन | विंडो का साइज़ बदलने के बाद, कॉलबैक को ट्रिगर किया जाता है. कॉलबैक को डिवाइस की जानकारी वाला ऑब्जेक्ट पास किया जाता है. |
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-26 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eTriggers a provided function when the webpage loads or the browser window is resized.\u003c/p\u003e\n"],["\u003cp\u003eProvides details about the device used, such as whether it is a mobile, tablet, or desktop, its orientation (portrait or landscape), and the window's dimensions in pixels.\u003c/p\u003e\n"],["\u003cp\u003eUtilizes boolean fields ("is_mobile", "is_tablet", "is_desktop", "is_portrait", "is_landscape") and numeric fields ("width", "height") within a passed object to convey device information.\u003c/p\u003e\n"],["\u003cp\u003eCan be implemented using \u003ccode\u003eui.root.onResize(callback)\u003c/code\u003e, where \u003ccode\u003ecallback\u003c/code\u003e represents the function to be executed.\u003c/p\u003e\n"]]],[],null,["# ui.root.onResize\n\n\u003cbr /\u003e\n\nRegisters a callback that's fired when the script starts and whenever the browser window size changes. It will be passed an object with boolean fields \"is_mobile\", \"is_tablet\", \"is_desktop\", \"is_portrait\" and \"is_landscape\", and numeric fields \"width\" and \"height\".\n\n\u003cbr /\u003e\n\nThese fields indicate whether a user's device is mobile, tablet or desktop, the device orientation (portrait or landscape), and the width and height of the window in pixels. See the Width and Height (dp) section of device metrics at https://material.io/resources/devices/.\n\n| Usage | Returns |\n|------------------------------|---------|\n| `ui.root.onResize(callback)` | |\n\n| Argument | Type | Details |\n|------------|----------|------------------------------------------------------------------------------------------------------------------------------|\n| `callback` | Function | The callback to fire after the window has been resized. The callback is passed an object with the information of the device. |"]]