some cleanup, scroll not tamed yet...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-02-13 02:27:19 +04:00
parent f724931a7e
commit c3486c9c71
3 changed files with 43 additions and 73 deletions

View File

@ -60,9 +60,37 @@
<script src="magazine.js"></script> <script src="magazine.js"></script>
<script src="layout.js"></script> <script src="layout.js"></script>
<script src="platform.js"></script>
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
// log...
/*
var _log = $('<div id="log"></div>')
.css({
position: 'fixed',
background: 'silver',
opacity: 0.5,
width: 200,
height: '80%',
top: 10,
left: 10,
'z-index': 90000,
overflow: 'hidden',
padding: 10,
})
.text('log')
.appendTo($('body'))
function log(text){
_log.html(_log.html() + '<br>' + text + '')
_log.scrollTop(_log.prop('scrollHeight'))
}
function clear_log(){
_log.html('')
}
*/
// keyboard... // keyboard...
$(document) $(document)
.keydown(makeKeyboardHandler({ .keydown(makeKeyboardHandler({
@ -87,80 +115,21 @@ $(document).ready(function(){
}, },
function(k){console.log(k)})) function(k){console.log(k)}))
var _log = $('<div id="log"></div>')
.css({ if(NAVIGATE_RELATIVE_TO_VISIBLE){
position: 'fixed', $('.viewer')
background: 'silver', .on('scrollstop', function(evt){
opacity: 0.5, log('scrollstop...')
width: 200, // XXX for some reason, on android, this sets the page but
height: '80%', // does not actually scroll to it -- no animation and/or
top: 10, // .ScrollTo does notwork...
left: 10, setCurrentPage()
'z-index': 90000, })
overflow: 'hidden',
padding: 10,
})
.text('log')
.appendTo($('body'))
function log(text){
_log.html(_log.html() + '<br>' + text + '')
_log.scrollTop(_log.prop('scrollHeight'))
}
function clear_log(){
_log.html('')
} }
var v = $('.viewer')
var TIMEOUT = 200
window.touching = false
window.t = null
$('.viewer')
.on('scrollstop', function(evt){
log('scrollstop...')
setCurrentPage()
})
/*
.on('scroll', function(evt){
if(t != null){
clearTimeout(t)
}
t = setTimeout(function(){
//if(!touching){
v.trigger('scrollend')
//}
}, TIMEOUT)
})
.on('touchstart mousedown', function(evt){
//touching = true
})
.on('touchend mouseup', function(evt){
//touching = false
//setCurrentPage()
})
.on('scrollend', function(){
log('scrolling done...')
// XXX for some reason, on android, this sets the page but
// does not actually scroll to it -- no animation and/or
// .ScrollTo does notwork...
setCurrentPage()
})
*/
/*
if(!NAVIGATE_RELATIVE_TO_VISIBLE){ if(!NAVIGATE_RELATIVE_TO_VISIBLE){
$('.viewer').css({overflow: 'hidden'}) $('.viewer').css({overflow: 'hidden'})
} }
*/
// expand the templates... // expand the templates...
runMagazineTemplates() runMagazineTemplates()
@ -473,7 +442,7 @@ $(document).ready(function(){
</div> </div>
</div> </div>
</div> </div>
<div class="article vertical"> <!--div class="article vertical">
<div class="cover page"> <div class="cover page">
<div class="content"> <div class="content">
<h1>Article Cover</h1> <h1>Article Cover</h1>
@ -508,7 +477,7 @@ $(document).ready(function(){
</div> </div>
</div> </div>
</div> </div-->
<div class="article"> <div class="article">
<!-- page set --> <!-- page set -->
<div class="group" style="background: url(img.jpg) no-repeat right top; background-size: 100% auto; color: white;"> <div class="group" style="background: url(img.jpg) no-repeat right top; background-size: 100% auto; color: white;">

View File

@ -4,8 +4,8 @@
* *
**********************************************************************/ **********************************************************************/
//var NAVIGATE_RELATIVE_TO_VISIBLE = false var NAVIGATE_RELATIVE_TO_VISIBLE = false
var NAVIGATE_RELATIVE_TO_VISIBLE = true //var NAVIGATE_RELATIVE_TO_VISIBLE = true
var USE_PAGE_ALIGN = true var USE_PAGE_ALIGN = true

View File

@ -7,6 +7,7 @@
if(navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)){ if(navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry)/)){
UPDATE_HASH_URL_POSITION = false UPDATE_HASH_URL_POSITION = false
FULL_HISTORY_ENABLED = false FULL_HISTORY_ENABLED = false
NAVIGATE_RELATIVE_TO_VISIBLE = true
} }