control-freak-ide/Control-Freak-Documentation/jQuery/docs/entries/resize.json
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

1 line
2.0 KiB
JSON

{"name":"resize","type":"method","title":".resize()","deprecated":null,"removed":null,"desc":"Bind an event handler to the \"resize\" JavaScript event, or trigger that event on an element.","categories":["events/browser-events","version/1.0","version/1.4.3"],"entries":[{"return":"jQuery","signatures":[{"added":"1.0","argument":{"desc":"A function to execute each time the event is triggered.","name":"handler(eventObject)","type":"Function"}},{"added":"1.4.3","argument":[{"desc":"An object containing data that will be passed to the event handler.","name":"eventData","type":"PlainObject","optional":"true"},{"desc":"A function to execute each time the event is triggered.","name":"handler(eventObject)","type":"Function"}]},{"added":"1.0"}],"examples":{"desc":"To see the window width while (or after) it is resized, try:","code":"\n$( window ).resize(function() {\n $( \"body\" ).prepend( \"<div>\" + $( window ).width() + \"</div>\" );\n});\n"},"longdesc":"\n <p>This method is a shortcut for <code>.on('resize', handler)</code> in the first and second variations, and <code>.trigger( \"resize\" )</code> in the third.</p>\n <p>The <code>resize</code> event is sent to the <code>window</code> element when the size of the browser window changes:</p>\n <pre><code>\n$( window ).resize(function() {\n $( \"#log\" ).append( \"&lt;div&gt;Handler for .resize() called.&lt;/div&gt;\" );\n});\n </code></pre>\n <p>Now whenever the browser window's size is changed, the message is appended to &lt;div id=\"log\"&gt; one or more times, depending on the browser.</p>\n <p>Code in a <code>resize</code> handler should never rely on the number of times the handler is called. Depending on implementation, <code>resize</code> events can be sent continuously as the resizing is in progress (the typical behavior in Internet Explorer and WebKit-based browsers such as Safari and Chrome), or only once at the end of the resize operation (the typical behavior in some other browsers such as Opera).</p>\n "}]}