blob: 4383382c5e3734d2683eb1d325f96be1c7c0ffc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
JQuery Newstape
===================
Simple Touch-enabled News Ticker Plugin
Newstape is a really small jQuery text scroller plugin which automatically & vertically scrolls through a list of news feeds with support for mouse wheel, mouse drag and touch swipe events.
[DEMO](http://www.jqueryscript.net/demo/Simple-Touch-enabled-News-Ticker-Plugin-Newstape/)
How to use it:
-------------
Load jQuery library and the jQuery newstape plugin in your html page.
``` html
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script src="jquery.newstape.js"></script>
```
Load the optional jQuery mousewheel plugin for mouse wheel support.
``` html
<script src="jquery.mousewheel.min.js"></script>
```
Load the optional jquery.event.drag plugin for drag & swipe support.
``` html
<script src="jquery.event.drag.min.js"></script>
```
Create a basic news ticker as follow.
``` html
<div class="newstape">
<div class="newstape-content">
<div class="news-block">
<h3>News 1</h3>
<small>13.04.2015</small>
<p class="text-justify"> Content 1 ... </p>
<div class="text-right"> <a href="#">More</a> </div>
<hr />
</div>
<div class="news-block">
<h3>News 2</h3>
<small>13.04.2015</small>
<p class="text-justify"> Content 2 ... </p>
<div class="text-right"> <a href="#">More</a> </div>
<hr />
</div>
<div class="news-block">
<h3>News 3</h3>
<small>13.04.2015</small>
<p class="text-justify"> Content 3 ... </p>
<div class="text-right"> <a href="#">More</a> </div>
<hr />
</div>
</div>
</div>
```
Add your own CSS styles to the news ticker.
``` css
.newstape {
background-color: #3BB0D6;
color: #fff;
height: 400px;
overflow: hidden;
}
.newstape-content {
position: relative;
padding: 15px;
}
.newstape-drag { cursor: ns-resize; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }
```
Call the plugin to start the news ticker.
``` javascript
$('.newstape').newstape();
```
Default settings.
``` javascript
$('.newstape').newstape({
// timer period
period: 30,
// offset pixel count
offset: 1,
// mousewheel scrolling
mousewheel: true,
// mousewheel offset pixel count
mousewheelRate: 30,
// dragging tape content
dragable: true
});
```
|