Skip to main content

Search and Top Navigation

#7514 closed bug (notabug)

Opened June 28, 2011 07:05AM UTC

Closed July 19, 2011 06:10PM UTC

Last modified August 07, 2013 03:30PM UTC

resizable() triggers a $(window).resize with jQuery 1.6.1

Reported by: slavik524 Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.resizable Version: 1.8.13
Keywords: Cc:
Blocked by: Blocking:
Description

When start resizing a resizable div, $(window).resize fires immediately and continues to trigger until I stop resizing a div. It only behaves this way with jQuery 1.6.1 (all is fine with 1.5.2).

Sample code:


<!DOCTYPE html>
<html>
<head>
    <script src="js/jquery-1.6.1.min.js" type="text/javascript"></script>
    <script src="js/jquery-ui.js" type="text/javascript"></script>

    <style type="text/css">
        #div1 {
            width: 200px;
            height: 200px;
            top: 100px;
            left: 100px;
            position: relative;
            background: #888;
        }
        .ui-resizable-e {
            width: 12px;
            height: 100%;
            top: 0;
            right: 0;
            position: absolute;
            background: #333;
            cursor: e-resize;
        }
    </style>

    <script type="text/javascript">
        $(function() {
            $("#div1").resizable({ handles: "e" });
            $(window).resize(function() { alert("Window resized"); });
        });
    </script>

</head>
<body>

<div id="div1"></div>

</body>
</html>
Attachments (0)
Change History (8)

Changed July 19, 2011 06:10PM UTC by scottgonzalez comment:1

resolution: → invalid
status: newclosed

This is a bug in jQuery core: http://bugs.jquery.com/ticket/9841

Changed August 18, 2011 09:39PM UTC by brotherli comment:2

Can be workarounded with target checking:

$(window).resize(function(e) {
  if (e.target == window)
    /* do your stuff here */;
});

Changed January 24, 2013 04:02PM UTC by rcoleman comment:3

I understand why this and the jQuery core bugs were closed as invalid, but should we not be able to prevent the resize event from bubbling within the Resizable resize event handler? Event.stopPropagation() and returning false have no effect.

Changed January 24, 2013 04:08PM UTC by scottgonzalez comment:4

Event.stopPropagation() and returning false have no effect.

That is certainly not true. Please provide a reduced test case showing this behavior.

Changed May 31, 2013 01:27PM UTC by scottgonzalez comment:5

#8881 is a duplicate of this ticket.

Changed May 31, 2013 01:28PM UTC by scottgonzalez comment:6

#9350 is a duplicate of this ticket.

Changed August 07, 2013 02:37PM UTC by adriantoine comment:7

_comment0: This issue still occurs even using event.stopPropagation() and 'return false' on the resize callback: \ http://jsfiddle.net/Alshten/LXqLz/1375886361897692

This issue still occurs even when using event.stopPropagation() and 'return false' on the resize callback:

http://jsfiddle.net/Alshten/LXqLz/

Changed August 07, 2013 03:30PM UTC by scottgonzalez comment:8

There is no propagation to stop inside the callback. The callback occurs *after* the event has propagated.