Skip to content

Commit

Permalink
messed with the shifting of tiles (move them individually now), still…
Browse files Browse the repository at this point in the history
… need to do more
  • Loading branch information
arjunbaokar committed Jul 22, 2012
1 parent 48e434f commit d42f995
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 6 deletions.
14 changes: 12 additions & 2 deletions android/JoynMeSwipeTileActivity/assets/www/src/index.html
Expand Up @@ -15,18 +15,28 @@


<div class="tileContainer" id="r1"> <div class="tileContainer" id="r1">
<ul> <ul>
<li><a href="#" id="t1">event one</a></li> <li><a href="#" id="t0">event one</a></li>
<li><a href="#" id="t2">event two</a></li> <li><a href="#" id="t1">event two</a></li>
<li><a href="#" id="t2">event three</a></li>
</ul> </ul>
</div> </div>


<div class="clear"></div>

<div class="tileContainer" id="r2"> <div class="tileContainer" id="r2">
<ul> <ul>
<li><a href="#" id="t3">event one</a></li> <li><a href="#" id="t3">event one</a></li>
<li><a href="#" id="t4">event two</a></li> <li><a href="#" id="t4">event two</a></li>
</ul> </ul>
</div> </div>


<div class="tileContainer" id="r3">
<ul>
<li><a href="#" id="t5">event one</a></li>
<li><a href="#" id="t6">event two</a></li>
</ul>
</div>

<!-- <!--
<div data-role="page" id="swipemenu"> <div data-role="page" id="swipemenu">
<div data-role="header"> <div data-role="header">
Expand Down
Expand Up @@ -82,3 +82,8 @@
.ui-btn-down-r { border: 1px solid #225377; background: #79ae21; font-weight: bold; color: #fff; text-shadow: 0 -1px 1px #225377; background-image: -moz-linear-gradient(top, #bc770f, #e6590c); background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #bc770f),color-stop(1, #e6590c)); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#bc770f', EndColorStr='#e6590c')"; } .ui-btn-down-r { border: 1px solid #225377; background: #79ae21; font-weight: bold; color: #fff; text-shadow: 0 -1px 1px #225377; background-image: -moz-linear-gradient(top, #bc770f, #e6590c); background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #bc770f),color-stop(1, #e6590c)); -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorStr='#bc770f', EndColorStr='#e6590c')"; }
.ui-btn-down-r a.ui-link-inherit { color: #fff; } .ui-btn-down-r a.ui-link-inherit { color: #fff; }
.ui-btn-up-r, .ui-btn-hover-r, .ui-btn-down-r { font-family: Helvetica, Arial, sans-serif; } .ui-btn-up-r, .ui-btn-hover-r, .ui-btn-down-r { font-family: Helvetica, Arial, sans-serif; }


.clear{
clear:both;
}
Expand Up @@ -8,9 +8,11 @@ $(function(){
// remove any existing swipe areas // remove any existing swipe areas
$('.divSwipe').remove(); $('.divSwipe').remove();
// add swipe event to the list item, removing it first (if it exists) // add swipe event to the list item, removing it first (if it exists)
$('ul li').unbind('swiperight').bind('swiperight', function(e){ $('ul li').unbind('swiperight').bind('swiperight click', function(e){ // FIXME remove click for the phone
// reference the just swiped list item // reference the just swiped list item
var $li = $(this); var $li = $(this);
var tileId = e.target.id;

// remove all swipe divs first // remove all swipe divs first
$('.divSwipe').remove(); $('.divSwipe').remove();
// create buttons and div container // create buttons and div container
Expand All @@ -28,7 +30,7 @@ $(function(){
// insert swipe div into list item // insert swipe div into list item
$li.prepend($divSwipe); $li.prepend($divSwipe);


var name = '#r1'; var name = '#t0';


$(name).animate({ $(name).animate({
marginLeft: "3in", marginLeft: "3in",
Expand All @@ -48,5 +50,52 @@ $(function(){
$('body').unbind('tap'); $('body').unbind('tap');
}); });
}); });

// copied above and editing it now lol

$('ul li').unbind('swipeleft').bind('swipeleft', function(e){
// reference the just swiped list item
var $li = $(this);
var tileId = e.target.id;

// remove all swipe divs first
$('.divSwipe').remove();
// create buttons and div container
var $divSwipe = $('<div class="divSwipe"></div>');
var $myBtn01 = $('<a>Button One</a>')
.attr({
'class': 'aSwipeBtn ui-btn-up-b',
'href': 'page.html'
});
var $myBtn02 = $('<a>Button Two</a>')
.attr({
'class': 'aSwipeBtn ui-btn-up-e',
'href': 'page.html'
});
// insert swipe div into list item
$li.prepend($divSwipe);

var name = '#r1';

$(name).animate({
marginLeft: "-3in",
}, 400 );

// insert buttons into divSwipe

//$divSwipe.prepend($myBtn01,$myBtn02).show(1000);

// add escape route for swipe menu
$('body').bind('tap', function(e){
// if the triggering object is a button, fire it's tap event
if (e.target.className.indexOf('aSwipeBtn') >= 0) $(e.target).trigger('click');
// remove any existing cancel buttons
$('.divSwipe').remove();
// remove the event
$('body').unbind('tap');
});
});

})


}) // to get what was clicked on, look at function(event) -> event is important because that what was clicked on. not $li. event.target.id (get the id of the targeted thing)
8 changes: 7 additions & 1 deletion android/JoynMeSwipeTileActivity/assets/www/src/tile/tile.css
Expand Up @@ -37,5 +37,11 @@ li {




.tileContainer{ .tileContainer{
width: 320px; /*width: 320px;*/
overflow:hidden;
} }

#t1 {
position:absolute;
left:100px;
}

0 comments on commit d42f995

Please sign in to comment.