Переглянути джерело

Merge pull request #825 from tripal/tv3-fix_824-resize_event

Trigger a window resize event when the tripal_ds animation is complete
Lacey-Anne Sanderson 6 роки тому
батько
коміт
abfee4fc5a
1 змінених файлів з 13 додано та 1 видалено
  1. 13 1
      tripal_ds/theme/js/tripal_ds.js

+ 13 - 1
tripal_ds/theme/js/tripal_ds.js

@@ -34,7 +34,7 @@
           }
         });
       });
-      
+
       // Move the tripal pane to the first position when its TOC item is clicked.
       $('.tripal_pane-toc-list-item-link').each(function (i) {
         var id = '.tripal_pane-fieldset-' + $(this).attr('id');
@@ -63,6 +63,18 @@
             // Trigger expansion event to allow the pane content
             // to react to the size change
             $(id).trigger($.Event('tripal_ds_pane_expanded', {id: id}));
+            
+            // Trigger a window resize event to notify charting modules that
+            // the container dimensions has changed
+            if (typeof Event !== 'undefined') {
+              window.dispatchEvent(new Event('resize'));
+            }
+            else {
+              // Support IE
+              var event = window.document.createEvent('UIEvents');
+              event.initUIEvent('resize', true, false, window, 0);
+              window.dispatchEvent(event);
+            }
           });
           return false;
         });