Skip to content

Commit

Permalink
Fix transition from 'auto' in Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
danro committed Apr 21, 2014
1 parent a3af800 commit 761a160
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "tram",
"description": "Cross-browser CSS3 transitions in JavaScript",
"version": "0.7.6",
"version": "0.7.7",
"homepage": "https://github.com/BKWLD/tram",
"authors": [
"Dan Rogers <dan@danro.net>",
Expand Down
9 changes: 6 additions & 3 deletions dist/tram.js
@@ -1,5 +1,5 @@
/*!
* tram.js v0.7.6-global
* tram.js v0.7.7-global
* Cross-browser CSS3 transitions in JavaScript
* https://github.com/bkwld/tram
* MIT License
Expand Down Expand Up @@ -754,8 +754,11 @@ window.tram = (function (jQuery) {
this.active = true;
value = this.convert(value, this.type);
if (this.auto) {
// when transitioning from 'auto', we must always reset to computed
this.update(this.get());
// when transitioning from 'auto', we must reset to computed
if (this.el.style[this.name] == 'auto') {
this.update(this.get());
this.redraw();
}
if (value == 'auto') value = getAuto.call(this);
}
this.nextStyle = value;
Expand Down
8 changes: 4 additions & 4 deletions examples/to-from-auto.html
Expand Up @@ -17,7 +17,7 @@
<body>

<p>
Transition height from pixels to 'auto'.
Transition pixels -> 'auto'.
</p>

<div class="test test1">
Expand All @@ -39,7 +39,7 @@
</script>

<p>
Transition width from 'auto' to pixels.
Transition 'auto' -> pixels.
</p>

<div class="test test2"></div>
Expand All @@ -50,8 +50,8 @@
test2.width('auto');

tram(test2)
.add('width 500ms ease')
.start({ width: 200 })
.add('width 1s ease')
.start({ width: 0 });

</script>

Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "tram",
"description": "Cross-browser CSS3 transitions in JavaScript",
"version": "0.7.6",
"version": "0.7.7",
"homepage": "https://github.com/bkwld/tram",
"author": "Dan Rogers <dan@danro.net>",
"license": "MIT",
Expand Down
7 changes: 5 additions & 2 deletions src/tram.js
Expand Up @@ -456,8 +456,11 @@
this.active = true;
value = this.convert(value, this.type);
if (this.auto) {
// when transitioning from 'auto', we must always reset to computed
this.update(this.get());
// when transitioning from 'auto', we must reset to computed
if (this.el.style[this.name] == 'auto') {
this.update(this.get());
this.redraw();
}
if (value == 'auto') value = getAuto.call(this);
}
this.nextStyle = value;
Expand Down
2 changes: 1 addition & 1 deletion support/styles/example.css
Expand Up @@ -71,8 +71,8 @@ p {
.row {
clear: both;
max-width: 700px;
*zoom: 1;
}

.row:after {
content: "";
display: table;
Expand Down

0 comments on commit 761a160

Please sign in to comment.