Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/clinical-meteor/auto-resizing

Hooks for resizing UI elements.
https://github.com/clinical-meteor/auto-resizing

Last synced: about 2 months ago
JSON representation

Hooks for resizing UI elements.

Awesome Lists containing this project

README

        

## clinical-auto-resizing

Adds resizing hooks to your application to trigger UI element resizes.

======================================
#### Installation

````
meteor add clinical:auto-resizing
````

======================================
#### API

````js
Session.get('resize');
Session.get('appHeight');
Session.get('appWidth');
````

````html
{{#if isPortrait}}{{/if}}
{{#if isLandscape}}{{/if}}
````

======================================
#### Auto Refresh Templates on Browser Resize

Simply put ``

`` in any template, and your template will get rerendered when the browser window is resized.

````html




````

======================================
#### Manually Refresh Templates

Alternatively, you can trigger it by manually setting the resize session variable.

````js
Session.set('resize', new Date());
````

======================================
#### Custom Layout Logic

You can also specify locations of div by using ``Session.get('appWidth')`` and ``Session.get('appHeight')``.
````js
Template.appLayout.layout = function(){
Session.set('customDivHeight', $('#innerPanel').height() + 80);
if(Session.get('appWidth') > 1636){
Session.set('customDivLeft', (Session.get('appWidth') - 1536) * 0.5);
}else if(Session.get('appWidth') > 768){
Session.set('customDivLeft', (Session.get('appWidth') - 768) * 0.5);
}else{
Session.set('customDivLeft', 0);
}
}
````

======================================
#### Detecting Portrait and Landscape

````html


{{#if isPortrait}}

{{/if}}
{{#if isLandscape}}

{{/if}}

````

======================================
#### Dynamic Styling

````html

````

======================================
#### Licensing

MIT. Use as you will. Disrupt the current system. It needs all the help it can get.