forked from risq/jquery-advanced-news-ticker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
850 lines (831 loc) · 34.1 KB
/
index.html
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<title>JQuery Advanced News Ticker | risq</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="assets/css/main.css" rel="stylesheet">
<link href="assets/css/font-awesome.min.css" rel="stylesheet">
<link href="assets/css/prism.css" rel="stylesheet" />
<link href="assets/css/jquery.mCustomScrollbar.css" rel="stylesheet" type="text/css" />
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- <a class="navbar-brand" href="#"><i class="fa fa-bolt"></i></a> -->
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#">Home</a></li>
<li><a href="#examples">Examples</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#options-callbacks">Options & Callbacks</a></li>
<li><a href="#methods">Methods</a></li>
<li><a href="#download-title">Download</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li class="active">
<a class="git-link" href="https://github.com/risq" target="_blank">
<i class="fa fa-github"></i>risq
</a>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
<div id="hello">
<div class="container">
<div class="row">
<div class="col-lg-10 col-lg-offset-1 centered">
<h1>JQuery Advanced News Ticker</h1>
<div id="nt-title-container">
<ul id="nt-title">
<li>
A powerful, flexible and animated vertical news ticker plugin.
</li>
<li>
Provides hight flexibility thanks to numerous callbacks & methods.
</li>
<li>
Fully customizable to every kind of vertical scrolling need.
</li>
<li>
Light-weight and optimized JQuery plugin.
</li>
</ul>
</div>
<a href="https://github.com/risq/jquery-advanced-news-ticker/archive/master.zip" target="_blank"><span class="button">Download</span></a>
<a href="https://github.com/risq/jquery-advanced-news-ticker" target="_blank"><span class="button">View on GitHub</span></a>
</div><!-- /col-lg-8 -->
</div><!-- /row -->
</div> <!-- /container -->
</div><!-- /hello -->
<div class="title" id="examples">
<div class="row">
<div class="col-lg-12 centered">
<h3>EXAMPLES</h3>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-7 centered">
<div id="nt-example1-container">
<i class="fa fa-arrow-up" id="nt-example1-prev"></i>
<ul id="nt-example1">
<li>Etiam imperdiet volutpat libero eu tristique. Aenean, rutrum felis in. <a href="#">Read more...</a></li>
<li>Curabitur porttitor ante eget hendrerit adipiscing. Maecenas at magna. <a href="#">Read more...</a></li>
<li>Praesent ornare nisl lorem, ut condimentum lectus gravida ut. <a href="#">Read more...</a></li>
<li>Nunc ultrices tortor eu massa placerat posuere. Vivamus viverra sagittis. <a href="#">Read more...</a></li>
<li>Morbi sodales tellus sit amet leo congue bibendum. Ut non mauris eu neque. <a href="#">Read more...</a></li>
<li>In pharetra suscipit orci sed viverra. Praesent at sollicitudin tortor, id. <a href="#">Read more...</a> </li>
<li>Maecenas nec ligula sed est suscipit aliquet sed eget ipsum, suspendisse. <a href="#">Read more...</a></li>
<li>Onec bibendum consectetur diam, nec euismod urna venenatis eget.. <a href="#">Read more...</a> </li>
</ul>
<i class="fa fa-arrow-down" id="nt-example1-next"></i>
</div>
</div>
<div class="col-md-5 centered">
<br/><br/>
<h3>MULTILINES SIMPLE EXAMPLE</h3>
<pre><code class="language-javascript example-code">var nt_example1 = $('#nt-example1').newsTicker({
row_height: 80,
max_rows: 3,
duration: 4000,
prevButton: $('#nt-example1-prev'),
nextButton: $('#nt-example1-next')
});</code></pre>
</div>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-6 col-md-push-6 centered">
<div id="nt-example2-container">
<ul id="nt-example2">
<li data-infos="Cras sagittis nulla sit amet feugiat pulvinar. Fusce scelerisque aliquet purus, sit amet rutrum augue euismod ut. Aliquam erat volutpat. Integer convallis, ligula non bibendum dictum, ante lectus fringilla nunc, at euismod neque enim sit amet ante. In risus velit, porttitor blandit magna vel, adipiscing semper libero. ">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">08:12</span> Etiam imperdiet volutpat libero eu tristique.
</li>
<li data-infos="Quisque imperdiet, tellus et tempus mattis, risus ipsum molestie leo, in tincidunt nisl nunc at magna. Suspendisse pretium ullamcorper feugiat. Nunc quis egestas odio, eu vestibulum nisl. In hac habitasse platea dictumst. Aliquam vel dapibus lacus. Curabitur pharetra quam purus. Suspendisse sed nulla condimentum nibh blandit consectetur non eget velit.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">08:41</span> Curabitur porttitor ante eget hendrerit adipi.
</li>
<li data-infos="Vestibulum ac interdum quam, tempus aliquet purus. Nunc luctus augue ut pellentesque faucibus. Proin urna nunc, feugiat ac bibendum non, cursus id orci. Integer porttitor diam et odio pharetra, sed congue augue dapibus. Fusce ac tristique tortor. Aliquam adipiscing ligula in dui pretium ultrices.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">10:02</span> Praesent ornare nisl lorem, ut condi.
</li>
<li data-infos="Proin vulputate mi pharetra tellus semper dapibus. Vestibulum non metus convallis, lobortis velit eu, facilisis mauris. Mauris mattis ante sit amet nulla egestas, ut consectetur tortor tristique. In porttitor non eros nec scelerisque. Sed eu condimentum tellus, et feugiat urna. Duis semper ligula a risus suscipit, ut vestibulum mi tempor.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">10:14</span> Nunc ultrices tortor eu massa placerat posuere.
</li>
<li data-infos="Sed facilisis, erat at accumsan tincidunt, metus diam convallis tortor, at facilisis tortor libero sed ante. Sed ut felis sed felis scelerisque bibendum. Ut quis aliquet magna. Phasellus elementum volutpat mattis. Proin in rutrum ante, at imperdiet dolor. Vivamus congue turpis facilisis congue ullamcorper. Etiam sollicitudin quis dolor hendrerit ultricies.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">11:23</span> Morbi sodales tellus sit amet leo congue bibendum.
</li>
<li data-infos="Raesent aliquam sapien quis pretium vestibulum. Vestibulum varius velit leo, quis facilisis enim mattis id. Proin et tempor ligula, id dapibus neque. Aliquam egestas adipiscing tellus. Morbi enim leo, fringilla eget vulputate tincidunt, fringilla et sapien. Curabitur ultricies auctor lectus, quis ultricies sem tincidunt sit amet. Mauris non tempor ipsum. Sed sed ipsum nulla. Quisque laoreet velit dolor, nec placerat odio ullamcorper eget.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">11:45</span> In pharetra suscipit orci sed viverra. Praesent at.
</li>
<li data-infos="Praesent ut eleifend lorem. Duis ut velit quis mauris molestie aliquam vitae id diam. Etiam eget mauris condimentum, lacinia lectus et, aliquet ligula. Nulla rutrum tincidunt tincidunt. Maecenas eu dolor vestibulum, pellentesque erat non, molestie nibh. Morbi ac semper quam. Aliquam erat volutpat.">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">11:55</span> Maecenas nec ligula sed est suscipit aliquet sed.
</li>
<li data-infos="Duis euismod, mi nec posuere malesuada, nisl leo bibendum ligula, sit amet vestibulum est neque non sapien. Curabitur mi massa, bibendum cursus scelerisque imperdiet, semper eu lacus. Etiam mauris eros, faucibus eu pretium vitae, rutrum vel urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Proin laoreet pellentesque felis, sed vulputate justo rhoncus et. ">
<i class="fa fa-fw fa-play state"></i>
<span class="hour">12:00</span> Onec bibendum consectetur diam, nec eui.
</li>
</ul>
<div id="nt-example2-infos-container">
<div id="nt-example2-infos-triangle"></div>
<div id="nt-example2-infos" class="row">
<div class="col-xs-4 centered">
<div class="infos-hour">
08:12
</div>
<i class="fa fa-arrow-left" id="nt-example2-prev"></i>
<i class="fa fa-arrow-right" id="nt-example2-next"></i>
</div>
<div class="col-xs-8">
<div class="infos-text">Cras sagittis nulla sit amet feugiat pulvinar. Fusce scelerisque aliquet purus, sit amet rutrum augue euismod ut. Aliquam erat volutpat. Integer convallis, ligula non bibendum dictum, ante lectus fringilla nunc, at euismod neque enim sit amet ante. In risus velit, porttitor blandit magna vel, adipiscing semper libero.</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-md-pull-6 centered">
<h3>ONE LINE TICKER WITH CALLBACKS & METHODS EXAMPLE</h3>
<pre><code class="language-javascript example-code">var nt_example2 = $('#nt-example2').newsTicker({
row_height: 60,
max_rows: 1,
speed: 300,
duration: 6000,
prevButton: $('#nt-example2-prev'),
nextButton: $('#nt-example2-next'),
hasMoved: function() {
$('#nt-example2-infos-container').fadeOut(200, function(){
$('#nt-example2-infos .infos-hour').text($('#nt-example2 li:first span').text());
$('#nt-example2-infos .infos-text').text($('#nt-example2 li:first').data('infos'));
$(this).fadeIn(400);
});
},
pause: function() {
$('#nt-example2 li i').removeClass('fa-play').addClass('fa-pause');
},
unpause: function() {
$('#nt-example2 li i').removeClass('fa-pause').addClass('fa-play');
}
});
$('#nt-example2-infos').hover(function() {
nt_example2.newsTicker('pause');
}, function() {
nt_example2.newsTicker('unpause');
});
</code></pre>
</div>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-4 centered">
<div id="nt-example3-container">
<!-- <i class="fa fa-arrow-up" id="nt-example3-prev"></i> -->
<ul id="nt-example3">
<li>Lorem</li>
<li>Ipsum</li>
<li>Praesent</li>
<li>Nunc</li>
<li>Morbi</li>
<li>Pharetra</li>
<li>Maecenas</li>
<li>Onec</li>
</ul>
<span class="button" id="nt-example3-button">START</span>
<!-- <i class="fa fa-arrow-down" id="nt-example3-next"></i> -->
</div>
</div>
<div class="col-md-8 centered">
<h3>BONUS : "ROULETTE" EXAMPLE, USING CALLBACKS & METHODS</h3>
<pre><code class="language-javascript example-code">var state = 'stopped';
var speed;
var add;
var nt_example3 = $('#nt-example3').newsTicker({
row_height: 80,
max_rows: 1,
duration: 0,
speed: 10,
autostart: 0,
pauseOnHover: 0,
hasMoved: function() {
if (speed > 700) {
$('#nt-example3').newsTicker("stop");
console.log('stop')
$('#nt-example3-button').text("RESULT: " + $('#nt-example3 li:first').text().toUpperCase());
setTimeout(function() {
$('#nt-example3-button').text("START");
state = 'stopped';
},2500);
}
else if (state == 'stopping') {
add = add * 1.4;
speed = speed + add;
console.log(speed)
$('#nt-example3').newsTicker('updateOption', "duration", speed + 25);
$('#nt-example3').newsTicker('updateOption', "speed", speed);
}
}
});
$('#nt-example3-button').click(function(){
if (state == 'stopped') {
state = 'turning';
speed = 1;
add = 1;
$('#nt-example3').newsTicker('updateOption', "duration", 0);
$('#nt-example3').newsTicker('updateOption', "speed", speed);
nt_example3.newsTicker('start');
$(this).text("STOP");
}
else if (state == 'turning') {
state = 'stopping';
$(this).text("WAITING...");
}
});</code></pre>
</div>
</div>
</div>
</div>
<div class="title" id="usage">
<div class="row">
<div class="col-lg-12 centered">
<h3>USAGE</h3>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
HTML: a simple list, which may be fully customized.
</p>
<pre><code class="language-markup "><ul class="newsticker">
<li>Etiam imperdiet volutpat libero eu tristique.</li>
<li>Curabitur porttitor ante eget hendrerit adipiscing.</li>
<li>Praesent ornare nisl lorem, ut condimentum lectus gravida ut.</li>
<li>Nunc ultrices tortor eu massa placerat posuere.</li>
</ul>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="js/newsTicker.js"></script></code></pre>
</div>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
Basic usage :
</p>
<pre><code class="language-javascript ">$('.newsticker').newsTicker();</script></code></pre>
</div>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
With custom parameters:
</p>
<pre><code class="language-javascript ">$('.newsticker').newsTicker({
row_height: 48,
max_rows: 2,
speed: 600,
direction: 'up',
duration: 4000,
autostart: 1,
pauseOnHover: 0
});</script></code></pre>
</div>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
With (custom) control buttons :
</p>
<pre><code class="language-javascript ">$('.newsticker').newsTicker({
row_height: 64,
speed: 800,
prevButton: $('#prev-button'),
nextButton: $('#next-button'),
stopButton: $('#stop-button'),
startButton: $('#start-button')
});</script></code></pre>
</div>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
With callbacks :
</p>
<pre><code class="language-javascript ">$('.newsticker').newsTicker({
max_rows: 1,
duration: 6000,
startButton: $('.start'),
hasMoved: updateInfos,
start: function() {
console.log('newsTicker just started !');
},
pause: function() {
console.log('newsTicker has been paused.');
}
});
function updateInfos() {
//...
}</script></code></pre>
</div>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
With methods :
</p>
<pre><code class="language-javascript ">var nt = $('.newsticker').newsTicker({
autostart: 0,
speed: 400
});
nt.newsTicker('start');
$('.newsTicker-header').hover(function() {
nt.newsTicker('pause');
}, function() {
nt.newsTicker('unpause');
});
nt.newsTicker('updateOption','speed',1000);
nt.newsTicker('updateOption','direction','down');</script></code></pre>
</div>
</div>
</div>
</div>
<div class="title" id="options-callbacks">
<div class="row">
<div class="col-lg-12 centered">
<h3>OPTIONS & CALLBACKS</h3>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<table class="table table-striped params-table">
<thead>
<tr>
<th>Parameter</th>
<th>Usage</th>
<th>Type/Values</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>row_height</code></td>
<td>defines the height (in px) of one row</td>
<td><code>int</code></td>
<td><em>22</em></td>
</tr>
<tr>
<td><code>max_row</code></td>
<td>defines the number of rows displayed at the same time</td>
<td><code>int</code></td>
<td><em>3</em></td>
</tr>
<tr>
<td><code>speed</code></td>
<td>defines the animation speed (in ms)of the rows moving up or
down</td>
<td><code>int</code> <em>(in ms)</em></td>
<td><em>400</em></td>
</tr>
<tr>
<td><code>duration</code></td>
<td>defines the times (in ms) before the rows automatically
move</td>
<td><code>int</code> <em>(in ms)</em></td>
<td><em>2500</em></td>
</tr>
<tr>
<td><code>direction</code></td>
<td>defines the direction of the rows movement</td>
<td><code>up</code> <em>or</em> <code>down</code></td>
<td><em>'up'</em></td>
</tr>
<tr>
<td><code>autostart</code></td>
<td>enable/disable auto start on load</td>
<td><code>0</code> <em>or</em> <code>1</code></td>
<td><em>1</em></td>
</tr>
<tr>
<td><code>pauseOnHover</code></td>
<td>enable/disable pause when mouse hovers the newsTicker
element</td>
<td><code>0</code> <em>or</em> <code>1</code></td>
<td><em>1</em></td>
</tr>
<tr>
<td><code>nextButton</code></td>
<td>set the element triggering <code>next</code> action on
click</td>
<td><code>JQuery element</code></td>
<td><em>null</em></td>
</tr>
<tr>
<td><code>prevButton</code></td>
<td>set the element triggering <code>prev</code> action on
click</td>
<td><code>JQuery element</code></td>
<td><em>null</em></td>
</tr>
<tr>
<td><code>startButton</code></td>
<td>set the element triggering <code>start</code> action on
click</td>
<td><code>JQuery element</code></td>
<td><em>null</em></td>
</tr>
<tr>
<td><code>stopButton</code></td>
<td>set the element triggering <code>stop</code> action on
click</td>
<td><code>JQuery element</code></td>
<td><em>null</em></td>
</tr>
<tr>
<td><code>hasMoved</code></td>
<td><code>callback</code> called at the end of every movement
animation</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>movingUp</code></td>
<td><code>callback</code> called before launching <code>moving
up</code> action</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>movingDown</code></td>
<td><code>callback</code> called before launching <code>moving
down</code> action</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>start</code></td>
<td><code>callback</code> called on <code>start</code> action</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>stop</code></td>
<td><code>callback</code> called on <code>stop</code> action</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>pause</code></td>
<td><code>callback</code> called on <code>pause</code> action
(triggered on <code>mouseOver</code> if
<code>pauseOnHover=1</code>)</td>
<td><code>function</code></td>
<td></td>
</tr>
<tr>
<td><code>unpause</code></td>
<td>called on <code>unpause</code> action (triggered on
<code>mouseOut</code> if <code>pauseOnHover=1</code>)</td>
<td><code>function</code></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="title" id="methods">
<div class="row">
<div class="col-lg-12 centered">
<h3>METHODS</h3>
</div>
</div>
</div>
<div class="green">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<p>
After initializing a newsTicker instance, methods are called with
</p>
<pre><code class="language-javascript ">.newsTicker('methodName', 'param1', 'param2', ... )</script></code></pre>
<p>
Example :
</p>
<pre><code class="language-javascript ">var nt = $('.newsticker').newsTicker();
nt.newsTicker('stop');
nt.newsTicker('updateOption','direction','down');
var state = nt.newsTicker('getState');</script></code></pre>
</div>
</div>
</div>
</div>
<div class="white">
<div class="container">
<div class="row">
<div class="col-md-12 col-lg-10 col-lg-offset-1">
<h2 class="header">Methods List</h2>
<table class="table table-striped params-table">
<thead>
<tr>
<th>Method</th>
<th>Parameter(s)</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>start</code></td>
<td></td>
<td>starts moving newsTicker elements</td>
</tr>
<tr>
<td><code>stop</code></td>
<td></td>
<td>stops moving newsTicker elements</td>
</tr>
<tr>
<td><code>updateOption</code></td>
<td><code>optionName</code>, <code>value</code></td>
<td>update an option (see <strong>Options & Callbacks</strong>
for options list)</td>
</tr>
<tr>
<td><code>getState</code></td>
<td></td>
<td>returns current state : <code>0</code> = stopped,
<code>1</code> = started, <code>2</code> = paused (and
started)</td>
</tr>
<tr>
<td><code>pause</code></td>
<td></td>
<td>pauses newsTicker elements without stopping them - the
newsTicker has to be started to be able to pause it (the
<code>pause</code> method is called on <code>mouseOver</code> if
<code>pauseOnHover</code> = 1)</td>
</tr>
<tr>
<td><code>unpause</code></td>
<td></td>
<td>unpauses newsTicker elements - the newsTicker has to be started
& paused to be able to unpause it (the <code>unpause</code>
method is called on <code>mouseOut</code> if
<code>pauseOnHover</code> = 1)</td>
</tr>
<tr>
<td><code>moveDown</code></td>
<td></td>
<td>moves elements down</td>
</tr>
<tr>
<td><code>moveUp</code></td>
<td></td>
<td>moves elements up</td>
</tr>
<tr>
<td><code>moveNext</code></td>
<td></td>
<td>moves up or down according to the current
<code>direction</code> option</td>
</tr>
<tr>
<td><code>movePrev</code></td>
<td></td>
<td>moves up or down according to the current
<code>direction</code> option</td>
</tr>
<tr>
<td><code>move</code></td>
<td></td>
<td>equivalent to <code>moveNext</code>, but will not move if
<code>paused</code></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="download-title" id="download-title">
<div class="container">
<div class="row centered">
<h3>DOWNLOAD</h3>
</div><!-- /row -->
</div><!-- /container -->
</div><!-- /download-title -->
<div id="download">
<div class="container">
<div class="row centered">
<div class="col-lg-8 col-lg-offset-2">
<div class="col-md-6 download-link">
<a href="https://github.com/risq/jquery-advanced-news-ticker/archive/master.zip" target="_blank">
<i class="fa fa-download"></i>
<div class="download-text">DOWNLOAD</div>
</a>
</div>
<div class="col-md-6 download-link">
<a href="https://github.com/risq/jquery-advanced-news-ticker" target="_blank">
<i class="fa fa-github"></i>
<div class="download-text">FORK ON GITHUB</div>
</a>
</div>
</div>
</div>
</div><!-- /container -->
</div><!-- /download -->
<div id="f">
<div class="container">
<div class="row">
<h3>Share this page</h3>
<div id="s-icons">
<a href="http://www.facebook.com/sharer.php?u=http://risq.github.io/jquery-advanced-news-ticker/" target="_blank"><span class="fa fa-facebook"></span></a>
<a href="http://twitter.com/share?url=http://risq.github.io/jquery-advanced-news-ticker/&text=JQuery Advanced News Ticker Plugin" target="_blank"><span class="fa fa-twitter"></span></a>
<a href="https://plus.google.com/share?url=http://risq.github.io/jquery-advanced-news-ticker/" target="_blank"><span class="fa fa-google-plus"></span></a>
<a href="http://www.linkedin.com/shareArticle?mini=true&url=http://risq.github.io/jquery-advanced-news-ticker/" target="_blank"><span class="fa fa-linkedin"></span></a>
<a href="javascript:void((function()%7Bvar%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('charset','UTF-8');e.setAttribute('src','http://assets.pinterest.com/js/pinmarklet.js?r='+Math.random()*99999999);document.body.appendChild(e)%7D)());"><span class="fa fa-pinterest"></span></a>
<a href="mailto:?Subject=JQuery Advanced News Ticker Plugin&Body=http://risq.github.io/jquery-advanced-news-ticker/"><span class="fa fa-envelope"></span></a>
<script id='fbkt5nx'>(function(i){var f,s=document.getElementById(i);f=document.createElement('iframe');f.src='//api.flattr.com/button/view/?uid=risq&url='+encodeURIComponent(document.URL);f.title='Flattr';f.height=62;f.width=55;f.style.borderWidth=0;s.parentNode.insertBefore(f,s);})('fbkt5nx');</script>
</div>
<p>Created by <a href="https://github.com/risq" target="_blank">risq</a></p>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="assets/js/chart.js"></script>
<script src="assets/js/bootstrap.js"></script>
<script src="assets/js/prism.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.min.js"></script>
<script src="jquery.newsTicker.js"></script>
<script>
$('a[href*=#]').click(function(e) {
var href = $.attr(this, 'href');
if (href != "#") {
$('html, body').animate({
scrollTop: $(href).offset().top - 81
}, 500);
}
else {
$('html, body').animate({
scrollTop: 0
}, 500);
}
return false;
});
$(window).load(function(){
$('code.language-javascript').mCustomScrollbar();
});
var nt_title = $('#nt-title').newsTicker({
row_height: 40,
max_rows: 1,
duration: 3000,
pauseOnHover: 0
});
var nt_example1 = $('#nt-example1').newsTicker({
row_height: 80,
max_rows: 3,
duration: 4000,
prevButton: $('#nt-example1-prev'),
nextButton: $('#nt-example1-next')
});
var nt_example2 = $('#nt-example2').newsTicker({
row_height: 60,
max_rows: 1,
speed: 300,
duration: 6000,
prevButton: $('#nt-example2-prev'),
nextButton: $('#nt-example2-next'),
hasMoved: function() {
$('#nt-example2-infos-container').fadeOut(200, function(){
$('#nt-example2-infos .infos-hour').text($('#nt-example2 li:first span').text());
$('#nt-example2-infos .infos-text').text($('#nt-example2 li:first').data('infos'));
$(this).fadeIn(400);
});
},
pause: function() {
$('#nt-example2 li i').removeClass('fa-play').addClass('fa-pause');
},
unpause: function() {
$('#nt-example2 li i').removeClass('fa-pause').addClass('fa-play');
}
});
$('#nt-example2-infos').hover(function() {
nt_example2.newsTicker('pause');
}, function() {
nt_example2.newsTicker('unpause');
});
var state = 'stopped';
var speed;
var add;
var nt_example3 = $('#nt-example3').newsTicker({
row_height: 80,
max_rows: 1,
duration: 0,
speed: 10,
autostart: 0,
pauseOnHover: 0,
hasMoved: function() {
if (speed > 700) {
$('#nt-example3').newsTicker("stop");
console.log('stop')
$('#nt-example3-button').text("RESULT: " + $('#nt-example3 li:first').text().toUpperCase());
setTimeout(function() {
$('#nt-example3-button').text("START");
state = 'stopped';
},2500);
}
else if (state == 'stopping') {
add = add * 1.4;
speed = speed + add;
console.log(speed)
$('#nt-example3').newsTicker('updateOption', "duration", speed + 25);
$('#nt-example3').newsTicker('updateOption', "speed", speed);
}
}
});
$('#nt-example3-button').click(function(){
if (state == 'stopped') {
state = 'turning';
speed = 1;
add = 1;
$('#nt-example3').newsTicker('updateOption', "duration", 0);
$('#nt-example3').newsTicker('updateOption', "speed", speed);
nt_example3.newsTicker('start');
$(this).text("STOP");
}
else if (state == 'turning') {
state = 'stopping';
$(this).text("WAITING...");
}
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48039933-1', 'risq.github.io');
ga('send', 'pageview');
</script>
</body>
</html>