Skip to content

Commit

Permalink
upd tile click transform for anchors
Browse files Browse the repository at this point in the history
  • Loading branch information
olton committed Feb 5, 2014
1 parent 35d12f7 commit 5e705e5
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 29 deletions.
4 changes: 2 additions & 2 deletions docs/js/metro.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docs/js/metro/metro-tile-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
var element = this.element;
var dim = {w: element.width(), h: element.height()};

element.on('click', function(e){
// e.preventDefault();
// if (element[0].tagName == 'A' && element.attr('href')) {
// document.location.href = element.attr('href');
// }
});

element.on('mousedown', function(e){
var X = e.pageX - $(this).offset().left, Y = e.pageY - $(this).offset().top;
var transform = 'top';
Expand All @@ -23,6 +30,12 @@
}

$(this).addClass("tile-transform-"+transform);

if (element[0].tagName == 'A' && element.attr('href')) {
setTimeout(function(){
document.location.href = element.attr('href');
}, 500);
}
});

element.on('mouseup', function(){
Expand Down
8 changes: 2 additions & 6 deletions docs/start-screen.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,8 @@ <h1 class="tile-area-title fg-white">Start</h1>
</div>
</a> <!-- end tile -->

<a class="tile double bg-violet" style="overflow: visible" data-click="transform">
<div class="tile-content" style="overflow: visible">
<div class="input-control text span2 place-left margin10" style="margin-left: 10px" data-role="datepicker">
<input type="text" name="sel_date">
<button class="btn-date"></button>
</div>
<a class="tile double bg-violet" data-click="transform">
<div class="tile-content">
<div class="text-right padding10 ntp">
<h1 class="fg-white no-margin">10</h1>
<p class="fg-white">Sunday</p>
Expand Down
34 changes: 15 additions & 19 deletions docs/tiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -632,33 +632,29 @@ <h3>Live Tile</h3>

<h3>Tile click transform</h3>
<p class="description">
You can set effect with <code>data-click="transform"</code> attribute and tiles can be placed inside in <code>tile-group</code> layer.
You can set effect with <code>data-click="transform"</code> attribute.
</p>

<div class="example">
<div class="tile-group no-margin">
<div class="tile half bg-darkRed ol-transparent" data-click="transform">
<div class="tile-content icon">
<i class="icon-rocket"></i>
</div>
</div>
<div class="tile bg-green ol-transparent" data-click="transform">
<div class="tile-content icon">
<img src="images/excel2013icon.png">
</div>
<div class="tile half bg-darkRed ol-transparent" data-click="transform">
<div class="tile-content icon">
<i class="icon-rocket"></i>
</div>
<div class="tile double ol-transparent" data-click="transform">
<div class="tile-content image">
<img src="images/1.jpg">
</div>
</div>
<div class="tile bg-green ol-transparent" data-click="transform">
<div class="tile-content icon">
<img src="images/excel2013icon.png">
</div>
</div>
<a class="tile double ol-transparent" data-click="transform">
<div class="tile-content image">
<img src="images/1.jpg">
</div>
</a>
</div>
<pre class="prettyprint linenums">
&lt;div class="tile-group"&gt;
&lt;div class="tile" data-click="transform"&gt;
...
&lt;/div&gt;
&lt;div class="tile" data-click="transform"&gt;
...
&lt;/div&gt;
</pre>

Expand Down
13 changes: 13 additions & 0 deletions js/metro-tile-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
var element = this.element;
var dim = {w: element.width(), h: element.height()};

element.on('click', function(e){
// e.preventDefault();
// if (element[0].tagName == 'A' && element.attr('href')) {
// document.location.href = element.attr('href');
// }
});

element.on('mousedown', function(e){
var X = e.pageX - $(this).offset().left, Y = e.pageY - $(this).offset().top;
var transform = 'top';
Expand All @@ -23,6 +30,12 @@
}

$(this).addClass("tile-transform-"+transform);

if (element[0].tagName == 'A' && element.attr('href')) {
setTimeout(function(){
document.location.href = element.attr('href');
}, 500);
}
});

element.on('mouseup', function(){
Expand Down
Loading

0 comments on commit 5e705e5

Please sign in to comment.