-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rodrigo
committed
Feb 15, 2014
0 parents
commit dd51db3
Showing
6 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.DS_STORE | ||
tvcredits.sublime-project | ||
tvcredits.sublime-workspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="http://code.jquery.com/jquery-latest.js"></script> | ||
<script src="tvcredits.jquery.min.js"></script> | ||
<meta charset=utf-8 /> | ||
<link href="style.css" rel="stylesheet"> | ||
<title>Demo</title> | ||
</head> | ||
<body> | ||
<div id="highlights"> | ||
<ul> | ||
<li>Mussum ipsum cacilds, vidis litro abertis. Consetis adipiscings elitis.</li> | ||
<li>Pra lá , depois divoltis porris, paradis. Paisis, filhis, espiritis santis.</li> | ||
<li>Mé faiz elementum girarzis, nisi eros vermeio, in elementis mé pra quem é amistosis quis leo.</li> | ||
<li>Manduma pindureta quium dia nois paga.</li> | ||
<li>Sapien in monti palavris qui num significa nadis i pareci latim. </li> | ||
<li>Interessantiss quisso pudia ce receita de bolis, mais bolis eu num gostis.</li> | ||
</ul> | ||
</div> | ||
|
||
|
||
<div id="credits"> | ||
<ul> | ||
<li>Lorene Nichols</li> | ||
<li>Ed Figueroa</li> | ||
<li>Sue Klein</li> | ||
<li>Sharon Warren</li> | ||
<li>Marta Maldonado</li> | ||
<li>Manuel Flowers</li> | ||
<li>Lila Chambers</li> | ||
<li>Yolanda Haynes</li> | ||
<li>Alfonso Lynch</li> | ||
<li>Janie Reese</li> | ||
</ul> | ||
</div> | ||
|
||
</body> | ||
<script> | ||
$("#highlights").tvCredits({ | ||
direction: 'left', | ||
speed: 50000, | ||
}); | ||
$("#credits").tvCredits({ | ||
height: 100, | ||
speed: 9000 | ||
}); | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#highlights { | ||
border: #000 1px solid; | ||
overflow: hidden; | ||
width: 50%; | ||
margin: 0 auto; | ||
} | ||
|
||
#credits { | ||
border: #000 1px solid; | ||
overflow: hidden; | ||
width: 50%; | ||
margin: 50px auto; | ||
} | ||
|
||
#credits ul { | ||
list-style: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
$.fn.tvCredits = function (options) { | ||
return this.each(function () { | ||
|
||
var defaults = { | ||
direction: 'up', | ||
complete : function () { | ||
}, | ||
speed : 25000, | ||
height : 350 | ||
} | ||
|
||
var settings = $.extend(defaults, options) | ||
, element = $(this) | ||
, list = element.find("ul") | ||
, children = list.children() | ||
, speed = settings.speed | ||
, loop = 0 | ||
, animation; | ||
|
||
var start = function (loop, containerWidth) { | ||
|
||
if (settings.direction == 'left') { | ||
|
||
// reset margins | ||
list.css('margin-top', 0); | ||
list.css('margin-bottom', 0); | ||
|
||
if (loop == 0) { | ||
|
||
// change elements to be displayed inline | ||
element.css('display', 'block'); | ||
list.css('display', 'inline-block'); | ||
children.css('display', 'inline'); | ||
|
||
// recalculate element width | ||
containerWidth = 0; | ||
children.each(function () { | ||
containerWidth += $(this).innerWidth(); | ||
}); | ||
containerWidth += containerWidth; | ||
var currentWidth = list.innerWidth(); | ||
if (currentWidth < containerWidth) { | ||
list.css('width', containerWidth + 'px'); | ||
} | ||
} | ||
|
||
// reset margin-left | ||
list.css("margin-left", '100%'); | ||
|
||
animation = {"margin-left": '-' + containerWidth + 'px' } | ||
|
||
loop++; | ||
|
||
} else { | ||
|
||
var elementHeight = settings.height; | ||
element.css('height', settings.height + 'px'); | ||
|
||
list.css('margin-top', elementHeight - (elementHeight * 0.2) +'px'); | ||
list.css('margin-bottom', '-' + elementHeight + 'px'); | ||
|
||
if (loop == 0) { | ||
// reset display | ||
element.css('display', 'table'); | ||
list.css('display', 'block'); | ||
children.css('display', 'block'); | ||
|
||
list.css('margin-left', 0); | ||
list.css('width', '90%'); | ||
} | ||
|
||
// recalculate element height | ||
var containerHeight = 0; | ||
children.each(function () { | ||
containerHeight += $(this).height(); | ||
}); | ||
|
||
list.css('height', elementHeight); | ||
|
||
animation = {"margin-top": '-' + (containerHeight * 2) + 'px'}; | ||
|
||
loop++; | ||
} | ||
|
||
list.animate(animation, speed, 'linear', function () { | ||
settings.complete(); | ||
start(loop, containerWidth); | ||
}); | ||
} | ||
|
||
start(loop, null); | ||
|
||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "tvcredits", | ||
"title": "TV Credits", | ||
"description": "Horizontal and vertical scroll jQuery plugin. It can be used as a horizontal ticker or a vertical TV credits scroll style.", | ||
"keywords": [ | ||
"scroll", | ||
"animation", | ||
"ticker" | ||
], | ||
"version": "0.0.1", | ||
"author": { | ||
"name": "Rodrigo dos Santos", | ||
"url": "http://blog.dossantos.com.au" | ||
}, | ||
"maintainers": [ | ||
{ | ||
"name": "Rodrigo dos Santos", | ||
"url": "http://blog.dossantos.com.au" | ||
} | ||
], | ||
"licenses": [ | ||
{ | ||
"type": "BSD", | ||
"url": "http://www.opensource.org/licenses/bsd-license.php" | ||
} | ||
], | ||
|
||
"dependencies": { | ||
"jquery": ">=1.9" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.