Backbone Resizeable View
How do I make an backbone resizeable view?
A view class that responds to the window resizing.. What is a backbone resizeable view? How do you make a backbone resizeable view? This script and codes were developed by Jon Beebe on 23 January 2023, Monday.
Backbone Resizeable View - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Backbone Resizeable View</title> <script src="https://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel='stylesheet prefetch' href='https://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ body > div { background: #eee; position: absolute; padding: 24px;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <script type="text/html" id="view-tpl"> <h1>Resizeable!</h1> <p>When you resize the window this view will automatically adjust its dimensions to fit.</p>
</script> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.0/backbone-min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/backbone.marionette/1.5.1-bundled/backbone.marionette.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Backbone Resizeable View - Script Codes CSS Codes
body > div { background: #eee; position: absolute; padding: 24px;
}
Backbone Resizeable View - Script Codes JS Codes
var ResizeView = Backbone.View.extend({ template: '#view-tpl', initialize: function() { $(window).on('resize.resizeview', this.onResize.bind(this)); }, remove: function() { $(window).off('resize.resizeview'); Backbone.View.prototype.remove.call(this); }, render: function () { var $tmpl = $(this.template); var tmpl = _.template($tmpl.html()); this.$el.append(tmpl()); this.onResize(); return this; }, onResize: function () { var w = $(window).width() , h = $(window).height(); console.log('resize', w, h); this.resize(w, h); }, resize: function (w, h) { this.$el.css({ 'width': w, 'height': h }); }
});
var view = new ResizeView();
$('body').append(view.render().$el);
Developer | Jon Beebe |
Username | somethingkindawierd |
Uploaded | January 23, 2023 |
Rating | 3 |
Size | 2,513 Kb |
Views | 4,048 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Turning off Marionette wrapper div | 2,381 Kb |
MarionetteJS Cubed Layout | 6,108 Kb |
MarionetteJS Stack View Controller | 6,647 Kb |
Emberjs Boilerplate | 1,893 Kb |
React Powered Radial Progress with SVG | 3,700 Kb |
MarionetteJS Module Router 2 | 5,980 Kb |
AngularJS Mobile App Scaffolding | 6,560 Kb |
Emberjs Simple Calendar Component | 5,660 Kb |
Radial Progress with SVG | 3,581 Kb |
Leaflet.js - Mark Radius | 3,995 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Electric worm | Jeffibacache | 2,377 Kb |
JS Beispiel getElementsByClassName 3 | HSZG-Frontend-Kurs | 1,988 Kb |
12 DAYS OF XMAS | Proto78 | 2,313 Kb |
Box-sizing | Elad2412 | 1,572 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
3D-box | Parthviroja | 2,346 Kb |
Simple personal profile | Miroot | 2,856 Kb |
Sample Profile Screen | OurDailyBread | 5,375 Kb |
Slider | Mohammed-fawzy | 2,634 Kb |
Popover Example | Seanboom | 2,429 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!