all.js AP.resize callback

215 views
Skip to first unread message

Charlie Dowler

unread,
Sep 23, 2014, 11:53:32 AM9/23/14
to atlassian-...@googlegroups.com
Hi,

I'm working on a plugin inside the issue view and our content is generated using React, it is often changing the size of the view so I use AP.resize to trigger a resize.

This works out fine most of the time but in one particular case where we need to append a view after the iframe has changed height, there is no callback or promise in AP.resize for us to use.

Without this callback there is a slight flicker from the iframe scrollbar which distracts the user from the current focus.

Is there a workaround for this?

Cheers,
Charlie

Daniel Wester

unread,
Sep 23, 2014, 3:00:25 PM9/23/14
to atlassian-...@googlegroups.com
You could listen for the resize event. jQuery has a shortcut built in:

Doing something like:
 <script>
  
  AJS.$(window).resize(function()
  {
  
  alert('I changed size');
  });
  
  function resizeWindow()
  {
    AP.resize(100,200);
  }
  </script>
</head>
<body>
<button class="aui-button" onclick="resizeWindow()">Click me to resize</button>
</body>

will give you the events. Note though that you'll get multiple events since I believe that the AC javascript changes the dimensions one at a time (they kinda have to). But if you're just changing one dimension (the height) once or so - then this workaround might work.

Charlie Dowler

unread,
Sep 23, 2014, 5:14:18 PM9/23/14
to atlassian-...@googlegroups.com
I was thinking too much into it, the obvious answer is usually the correct one. I will give it a go tomorrow.

Thanks Daniel.
Reply all
Reply to author
Forward
0 new messages