Activate specific tab that is tapped/clicked.

This commit is contained in:
Robert Jackson 2014-08-07 09:32:10 -04:00
parent 7b21ca64a5
commit 6bb1ac1083
3 changed files with 19 additions and 8 deletions

View File

@ -45,9 +45,14 @@ var Codemirror = Ember.TextArea.extend(MarkerManager, {
var initMarkers = _.bind(this.initMarkers, this);
// Allow tabbing behaviour when viewing on small screen (not mobile)
$('.floatingheader').on('click', function () {
$('.entry-markdown').toggleClass('active');
$('.entry-preview').toggleClass('active');
$('#entry-markdown-header').on('click', function () {
$('.entry-markdown').addClass('active');
$('.entry-preview').removeClass('active');
});
$('#entry-preview-header').on('click', function () {
$('.entry-markdown').removeClass('active');
$('.entry-preview').addClass('active');
});
// replaces CodeMirror with TouchEditor only if we're on mobile

View File

@ -5,7 +5,7 @@
</header>
<section class="entry-markdown active">
<header class="floatingheader">
<header class="floatingheader" id="entry-markdown-header">
<small>Markdown</small>
<a class="markdown-help" href="" {{action "openModal" "markdown"}}><span class="hidden">What is Markdown?</span></a>
</header>
@ -15,7 +15,7 @@
</section>
<section class="entry-preview">
<header class="floatingheader">
<header class="floatingheader" id="entry-preview-header">
<small>Preview <span class="entry-word-count js-entry-word-count">{{gh-count-words scratch}}</span></small>
</header>
<section class="entry-preview-content">

View File

@ -29,11 +29,17 @@ init = function init() {
$('body').addClass('touch-editor');
// make editor tabs touch-to-toggle in portrait mode
$('.floatingheader').on('tap', function () {
$('.entry-markdown').toggleClass('active');
$('.entry-preview').toggleClass('active');
$('#entry-markdown-header').on('tap', function () {
$('.entry-markdown').addClass('active');
$('.entry-preview').removeClass('active');
});
$('#entry-preview-header').on('tap', function () {
$('.entry-markdown').removeClass('active');
$('.entry-preview').addClass('active');
});
Ember.touchEditor = true;
//initialize FastClick to remove touch delays
Ember.run.scheduleOnce('afterRender', null, function () {