-
-
Save kumkanillam/daa9ed3796ca5209c197382614576974 to your computer and use it in GitHub Desktop.
img-app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Component.extend({ | |
scrollingTimeout: 100, | |
bindScrolling: function() { | |
var self = this, | |
onScroll = function() { | |
Ember.run.debounce(self, self.runScrolled, self.scrollingTimeout); | |
}; | |
Ember.$(document).on('touchmove.scrollable', onScroll); | |
Ember.$(window).on('scroll.scrollable', onScroll); | |
}.on('didInsertElement'), | |
unbindScrolling: function() { | |
Ember.$(window).off('.scrollable'); | |
Ember.$(document).off('.scrollable'); | |
}.on('willDestroyElement'), | |
preservePos: function() { | |
console.log(' Preserve Position '+this.get('currentPos')); | |
Ember.$(window).scrollTop(this.getWithDefault('currentPos', 0)); | |
}.on('didInsertElement'), | |
runScrolled: function() { | |
var position = Ember.$(document).height() - Ember.$(window).scrollTop(); | |
var viewportHeight = document.documentElement.clientHeight; | |
this.set('currentPos', Ember.$(window).scrollTop()); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
currentPos:0 | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
import Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
export default Model.extend({ | |
id: attr(), | |
image: attr() | |
}); | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: config.locationType | |
}); | |
Router.map(function() { | |
this.route('index', {path:'/'}); | |
this.route('pic', {path:'/pic/:id'}); | |
}); | |
export default Router; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
var pics = [{ | |
id: 1, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'aaaaaaaaaaaaa' | |
}, { | |
id: 2, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'bbbbbbbbbbbbb' | |
}, { | |
id: 3, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'ccccccccccc' | |
},{ | |
id: 4, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'ddddddddddd' | |
},{ | |
id: 5, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'eeeeeeeeeeeeeee' | |
},{ | |
id: 6, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'fffffffffffffffffff' | |
},{ | |
id: 7, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'gggggggggggggggg' | |
},{ | |
id: 8, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'hhhhhhhhhhhhhhhh' | |
},{ | |
id: 9, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'iiiiiiiiiiiiiiii' | |
},{ | |
id: 10, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'jjjjjjjjjjjjjjjjjj' | |
},{ | |
id: 11, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'kkkkkkkkkkkkk' | |
},{ | |
id: 12, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'lllllllllllll' | |
},{ | |
id: 13, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'mmmmmmmmmmmmm' | |
},{ | |
id: 14, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'nnnnnnnnnnnnnnnn' | |
},{ | |
id: 15, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'ooooooooooooooooo' | |
},{ | |
id: 16, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'pppppppppppppppp' | |
},{ | |
id: 17, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'rrrrrrrrrrrrrrrrrrr' | |
},{ | |
id: 18, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'sssssssssssss' | |
},{ | |
id: 19, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'ttttttttttttttttt' | |
},{ | |
id: 20, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'uuuuuuuuuuuu' | |
},{ | |
id: 21, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'vvvvvvvvvvvvvvv' | |
},{ | |
id: 22, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'yyyyyyyyyyyyyyyyy' | |
},{ | |
id: 23, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'zzzzzzzzzzzz' | |
},{ | |
id: 24, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'xxxxxxxxxxxx' | |
},{ | |
id: 25, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'wwwwwwwwwwwww' | |
},{ | |
id: 26, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'qqqqqqqqqqqq' | |
},{ | |
id: 27, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/f/f7/Wheeldon_Apartment_Building_-_Portland_Oregon.jpg', | |
detail : 'wwwwwww' | |
},{ | |
id: 28, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/c/cb/Crane_estate_(5).jpg', | |
detail : 'zzzzzzzzzzzz' | |
},{ | |
id: 29, | |
image: 'https://upload.wikimedia.org/wikipedia/commons/0/0e/Alfonso_13_Highrise_Tegucigalpa.jpg', | |
detail : 'cccccccccccc' | |
}]; | |
export default Ember.Route.extend({ | |
model() { | |
return pics; | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
activate: function() { | |
this._super(...arguments); | |
window.scrollTo(0,0); | |
}, | |
model(params) { | |
console.info(params, "Params"); | |
} | |
}); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.8.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.5.1", | |
"ember-data": "2.5.2", | |
"ember-template-compiler": "2.5.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment