Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Is there a way to listen to Html Element Style changes - Backbone.JS
- <li id="imovel" style="<%= display %>">
- <div class="thumbnail">
- <a href="#">
- <img src="http://placehold.it/90x60"></img>
- <%= textvar %>
- </a>
- </div>
- </li>
- var imovelView = Backbone.View.extend({
- el: $('#imovel')
- ,template: _.template( $("#listing_template").html())
- ,events: {
- "change:display #imovel" : "activate"
- }
- ,initialize: function(){
- this.on('change:display', this.toggle, this);
- this.collection.bind('add', this.render, this);
- }
- ,activate: function(item){
- alert("change display");
- }
- ,render: function(item){
- var showPerPage = $('#show_per_page').val();
- var totalEntries = this.collection.length;
- var pageMax = Math.ceil( showPerPage/totalEntries );
- var displayValue = "display: none;";
- if(totalEntries <= showPerPage){
- displayValue = "display: block;";
- }
- var variables = { textvar: item.get("Lat"), display: displayValue };
- var template = this.template( variables );
- $('#max_page').val(pageMax);
- $('#content').append( template );
- resizeViewport();
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment