Ditty News Ticker - Version 1.1.7

Version Description

  • Modified structure & CSS to move the rotate navigation up a level.
Download this release

Release Info

Developer metaphorcreations
Plugin Icon 128x128 Ditty News Ticker
Version 1.1.7
Comparing to
See all releases

Code changes from version 1.1.6 to 1.1.7

assets/css/style.css CHANGED
@@ -12,6 +12,9 @@
12
  }
13
  .mtphr-dnt-tick-container {
14
  position: relative;
 
 
 
15
  overflow: hidden;
16
  }
17
  .mtphr-dnt-tick {
@@ -38,12 +41,12 @@
38
  top: 50%;
39
  margin-top: -19px;
40
  width: 38px;
41
- height: 38px;
42
  background: url(../images/navarrows.png) no-repeat;
43
  background-size: 76px 38px;
44
  }
45
- .mtphr-dnt-nav:focus {
46
- outline: none;
47
  }
48
  .mtphr-dnt-nav-prev {
49
  left: 10px;
@@ -54,10 +57,10 @@
54
  }
55
  .mtphr-dnt-nav-hide {
56
  opacity: 0;
57
- -webkit-transition: opacity .3s linear;
58
- -moz-transition: opacity .3s linear;
59
- -o-transition: opacity .3s linear;
60
- transition: opacity .3s linear;
61
  }
62
  .mtphr-dnt-tick-container:hover .mtphr-dnt-nav-hide {
63
  opacity: 1;
@@ -84,8 +87,8 @@
84
  .mtphr-dnt-control-button.active {
85
  background-position: 0 0;
86
  }
87
- .mtphr-dnt-control-button:focus {
88
- outline: none;
89
  }
90
 
91
  /* Add clearfix
12
  }
13
  .mtphr-dnt-tick-container {
14
  position: relative;
15
+ }
16
+ .mtphr-dnt-tick-contents {
17
+ position: relative;
18
  overflow: hidden;
19
  }
20
  .mtphr-dnt-tick {
41
  top: 50%;
42
  margin-top: -19px;
43
  width: 38px;
44
+ height: 38px;
45
  background: url(../images/navarrows.png) no-repeat;
46
  background-size: 76px 38px;
47
  }
48
+ .mtphr-dnt-nav:focus {
49
+ outline: none;
50
  }
51
  .mtphr-dnt-nav-prev {
52
  left: 10px;
57
  }
58
  .mtphr-dnt-nav-hide {
59
  opacity: 0;
60
+ -webkit-transition: opacity .3s linear;
61
+ -moz-transition: opacity .3s linear;
62
+ -o-transition: opacity .3s linear;
63
+ transition: opacity .3s linear;
64
  }
65
  .mtphr-dnt-tick-container:hover .mtphr-dnt-nav-hide {
66
  opacity: 1;
87
  .mtphr-dnt-control-button.active {
88
  background-position: 0 0;
89
  }
90
+ .mtphr-dnt-control-button:focus {
91
+ outline: none;
92
  }
93
 
94
  /* Add clearfix
assets/js/ditty-news-ticker.js CHANGED
@@ -1,16 +1,16 @@
1
  /**
2
  * Ditty News Ticker
3
- * Date: 3/21/2013
4
  *
5
  * @author Metaphor Creations
6
- * @version 1.1.3
7
  *
8
  **/
9
 
10
  ( function($) {
11
-
12
  var methods = {
13
-
14
  init : function( options ) {
15
 
16
  return this.each( function(){
@@ -35,7 +35,7 @@
35
  after_change : function(){},
36
  after_load : function(){}
37
  };
38
-
39
  // Useful variables. Play carefully.
40
  var vars = {
41
  id : settings.id,
@@ -44,35 +44,35 @@
44
  reverse : 0,
45
  running : 0
46
  };
47
-
48
  // Add any set options
49
- if (options) {
50
  $.extend(settings, options);
51
  }
52
 
53
  // Create variables
54
- var $ticker = $(this).find('.mtphr-dnt-tick-container'),
55
- $nav_prev = $ticker.find('.mtphr-dnt-nav-prev'),
56
- $nav_next = $ticker.find('.mtphr-dnt-nav-next'),
57
- $nav_controls = $ticker.siblings('.mtphr-dnt-control-links'),
58
- ticker_width = $ticker.outerWidth(),
59
- ticker_height = 0,
60
- ticks = [],
61
- ticker_scroll,
62
- ticker_scroll_resize = true,
63
- ticker_delay,
64
- rotate_adjustment = settings.rotate_type,
65
- after_change_timeout,
66
- ticker_pause = false,
67
- offset = 20,
68
- touch_down_x,
69
- touch_down_y,
70
- touch_link = '',
71
- touch_target = '';
72
 
73
  // Add the vars
74
  $ticker.data('ditty:vars', vars);
75
-
76
  // Save the tick count & total
77
  vars.tick_count = $ticker.find('.mtphr-dnt-tick').length;
78
 
@@ -82,15 +82,15 @@
82
  // Setup a ticker scroll
83
  if( settings.type == 'scroll' ) {
84
  mtphr_dnt_scroll_setup();
85
-
86
  // Setup a ticker rotator
87
  } else if( settings.type == 'rotate' ) {
88
  mtphr_dnt_rotator_setup();
89
- }
90
  }
91
-
92
-
93
-
94
  /**
95
  * Setup the ticker scroll
96
  *
@@ -103,50 +103,50 @@
103
  var style = $first.attr('style');
104
  var style_array = style.split('width:');
105
  ticker_scroll_resize = (style_array.length > 1) ? false : true;
106
- }
107
-
108
  // Loop through the tick items
109
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
110
-
111
  // Find the greatest tick height
112
  if( $(this).outerHeight() > ticker_height ) {
113
  ticker_height = $(this).outerHeight();
114
  }
115
-
116
  if( settings.scroll_direction == 'up' || settings.scroll_direction == 'down' ) {
117
  $(this).css('height', 'auto');
118
  }
119
  });
120
-
121
  // Set the ticker height
122
  $ticker.css('height',ticker_height+'px');
123
-
124
  // Loop through the tick items
125
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
126
-
127
  // Make sure the ticker is visible
128
  $(this).show();
129
-
130
  // Add the tick data
131
  var tick = [{'headline':$(this)}];
132
-
133
  // Add the tick to the array
134
  ticks.push(tick);
135
  });
136
-
137
  // Set the initial position of the ticks
138
  mtphr_dnt_scroll_reset_ticks();
139
-
140
  // Start the scroll loop
141
  mtphr_dnt_scroll_loop();
142
-
143
  // Clear the loop on mouse hover
144
  $ticker.hover(
145
  function () {
146
  if( settings.scroll_pause ) {
147
  clearInterval( ticker_scroll );
148
  }
149
- },
150
  function () {
151
  if( settings.scroll_pause ) {
152
  mtphr_dnt_scroll_loop();
@@ -154,26 +154,26 @@
154
  }
155
  );
156
  }
157
-
158
  /**
159
  * Create the ticker scroll loop
160
  *
161
  * @since 1.0.8
162
  */
163
  function mtphr_dnt_scroll_loop() {
164
-
165
  // Start the ticker timer
166
  clearInterval( ticker_scroll );
167
  ticker_scroll = setInterval( function() {
168
 
169
  for( var i=0; i<vars.tick_count; i++ ) {
170
-
171
  if( ticks[i][0].visible == true ) {
172
-
173
  var pos = 'reset';
174
-
175
  if( settings.scroll_direction == 'left' || settings.scroll_direction == 'right' ) {
176
-
177
  pos = (settings.scroll_direction == 'left') ? mtphr_dnt_scroll_left(i) : mtphr_dnt_scroll_right(i);
178
  if( pos == 'reset' ) {
179
  pos = ticks[i][0].reset;
@@ -184,7 +184,7 @@
184
  }, 100, 'linear' );
185
  }
186
  } else {
187
-
188
  pos = (settings.scroll_direction == 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
189
  if( pos == 'reset' ) {
190
  pos = ticks[i][0].reset;
@@ -195,11 +195,11 @@
195
  }, 100, 'linear' );
196
  }
197
  }
198
-
199
  ticks[i][0].position = pos;
200
  }
201
  }
202
- }, 100);
203
  }
204
 
205
  /**
@@ -208,108 +208,108 @@
208
  * @since 1.0.0
209
  */
210
  function mtphr_dnt_scroll_left( i ) {
211
-
212
  // Find the new position
213
  var pos = parseFloat(ticks[i][0].position - settings.scroll_speed);
214
-
215
  // Reset the tick if off the screen
216
  if( pos < -(ticks[i][0].width+offset) ) {
217
  pos = mtphr_dnt_scroll_check_current(i);
218
  } else if( pos < parseFloat(ticker_width-ticks[i][0].width-settings.scroll_spacing) ) {
219
  mtphr_dnt_scroll_check_next(i);
220
  }
221
-
222
  return pos;
223
  }
224
-
225
  /**
226
  * Scroll the ticker right
227
  *
228
  * @since 1.0.0
229
  */
230
  function mtphr_dnt_scroll_right( i ) {
231
-
232
  // Find the new position
233
  var pos = ticks[i][0].position + settings.scroll_speed;
234
 
235
  // Reset the tick if off the screen
236
  if( pos > ticker_width+offset ) {
237
  pos = mtphr_dnt_scroll_check_current(i);
238
- } else if( pos > settings.scroll_spacing ) {
239
  mtphr_dnt_scroll_check_next(i);
240
  }
241
-
242
  return pos;
243
  }
244
-
245
  /**
246
  * Scroll the ticker up
247
  *
248
  * @since 1.0.0
249
  */
250
  function mtphr_dnt_scroll_up( i ) {
251
-
252
  // Find the new position
253
  var pos = ticks[i][0].position - settings.scroll_speed;
254
 
255
  // Reset the tick if off the screen
256
  if( pos < -(ticks[i][0].height+offset) ) {
257
  pos = mtphr_dnt_scroll_check_current(i);
258
- } else if( pos < ticker_height-ticks[i][0].height-settings.scroll_spacing ) {
259
  mtphr_dnt_scroll_check_next(i);
260
  }
261
-
262
  return pos;
263
  }
264
-
265
  /**
266
  * Scroll the ticker down
267
  *
268
  * @since 1.0.0
269
  */
270
  function mtphr_dnt_scroll_down( i ) {
271
-
272
  // Find the new position
273
  var pos = ticks[i][0].position + settings.scroll_speed;
274
 
275
  // Reset the tick if off the screen
276
  if( pos > ticker_height+offset ) {
277
  pos = mtphr_dnt_scroll_check_current(i);
278
- } else if( pos > settings.scroll_spacing ) {
279
  mtphr_dnt_scroll_check_next(i);
280
  }
281
-
282
  return pos;
283
  }
284
-
285
  /**
286
  * Check the current tick position
287
  *
288
  * @since 1.0.0
289
  */
290
  function mtphr_dnt_scroll_check_current( i ) {
291
-
292
  if( vars.tick_count > 1 ) {
293
  ticks[i][0].visible = false;
294
  }
295
-
296
  return 'reset';
297
  }
298
-
299
  /**
300
  * Check the next tick visibility
301
  *
302
  * @since 1.0.0
303
  */
304
  function mtphr_dnt_scroll_check_next( i ) {
305
-
306
  if( i==(vars.tick_count-1) ) {
307
  ticks[0][0].visible = true;
308
  } else {
309
  ticks[(i+1)][0].visible = true;
310
  }
311
  }
312
-
313
  /**
314
  * Resize the scroll ticks
315
  *
@@ -318,12 +318,12 @@
318
  function mtphr_dnt_scroll_resize_ticks() {
319
 
320
  for( var i=0; i<vars.tick_count; i++ ) {
321
-
322
  // Set the tick position
323
  var position;
324
-
325
  var $tick = ticks[i][0].headline;
326
-
327
  switch( settings.scroll_direction ) {
328
  case 'left':
329
  position = ticker_width+offset;
@@ -331,14 +331,14 @@
331
  $tick.css('left',position+'px');
332
  }
333
  break;
334
-
335
  case 'right':
336
  position = parseInt('-'+($tick.outerWidth()+offset));
337
  if( ticks[i][0].visible == false ) {
338
  $tick.css('left',position+'px');
339
  }
340
  break;
341
-
342
  case 'up':
343
  if( ticker_scroll_resize ) {
344
  $tick.css('width',ticker_width);
@@ -348,7 +348,7 @@
348
  $tick.css('top',position+'px');
349
  }
350
  break;
351
-
352
  case 'down':
353
  if( ticker_scroll_resize ) {
354
  $tick.css('width',ticker_width);
@@ -359,7 +359,7 @@
359
  }
360
  break;
361
  }
362
-
363
  // Adjust the tick data
364
  ticks[i][0].width = $tick.outerWidth();
365
  ticks[i][0].height = $tick.outerHeight();
@@ -369,7 +369,7 @@
369
  ticks[i][0].reset = position;
370
  }
371
  }
372
-
373
  /**
374
  * Reset the scroller for vertical scrolls
375
  *
@@ -378,54 +378,54 @@
378
  function mtphr_dnt_scroll_reset_ticks() {
379
 
380
  for( var i=0; i<vars.tick_count; i++ ) {
381
-
382
  var $tick = ticks[i][0].headline;
383
-
384
  switch( settings.scroll_direction ) {
385
  case 'left':
386
  position = ticker_width+offset;
387
- $tick.stop(true,true).css('left',position+'px');
388
  break;
389
-
390
  case 'right':
391
  position = parseInt('-'+($tick.outerWidth()+offset));
392
- $tick.stop(true,true).css('left',position+'px');
393
  break;
394
-
395
  case 'up':
396
  if( ticker_scroll_resize ) {
397
  $tick.css('width',ticker_width);
398
  }
399
  position = parseInt(ticker_height+offset);
400
- $tick.stop(true,true).css('top',position+'px');
401
  break;
402
-
403
  case 'down':
404
  if( ticker_scroll_resize ) {
405
  $tick.css('width',ticker_width);
406
  }
407
  position = parseInt('-'+($tick.outerHeight()+offset));
408
- $tick.stop(true,true).css('top',position+'px');
409
  break;
410
  }
411
-
412
  ticks[i][0].width = $tick.outerWidth();
413
  ticks[i][0].height = $tick.outerHeight();
414
  ticks[i][0].position = position;
415
  ticks[i][0].reset = position;
416
  ticks[i][0].visible = false;
417
-
418
  // Reset the current tick
419
  vars.current_tick = 0;
420
-
421
  // Set the first tick visibility
422
- ticks[vars.current_tick][0].visible = true;
423
  }
424
  }
425
-
426
-
427
-
428
-
429
  /**
430
  * Setup the ticker rotator
431
  *
@@ -435,33 +435,33 @@
435
 
436
  // Loop through the tick items
437
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
438
-
439
  // Add the tick to the array
440
  ticks.push($(this));
441
-
442
  });
443
 
444
  // Resize the ticks
445
  mtphr_dnt_rotator_resize_ticks();
446
-
447
  // Find the rotation type and create the dynamic rotation init function
448
  var rotate_init_name = 'mtphr_dnt_rotator_'+settings.rotate_type+'_init';
449
  var mtphr_dnt_rotator_type_init = eval('('+rotate_init_name+')');
450
  mtphr_dnt_rotator_type_init( $ticker, ticks, parseInt(settings.rotate_speed*100), settings.rotate_ease );
451
  mtphr_dnt_rotator_update_links( 0 );
452
-
453
  // Start the rotator rotate
454
  if( settings.auto_rotate ) {
455
  mtphr_dnt_rotator_delay();
456
  }
457
-
458
  // Clear the loop on mouse hover
459
  $ticker.hover(
460
  function (e) {
461
  if( settings.auto_rotate && settings.rotate_pause && !vars.running ) {
462
  clearInterval( ticker_delay );
463
  }
464
- },
465
  function () {
466
  if( settings.auto_rotate && settings.rotate_pause && !vars.running ) {
467
  mtphr_dnt_rotator_delay();
@@ -469,7 +469,7 @@
469
  }
470
  );
471
  }
472
-
473
  /**
474
  * Create the ticker rotator loop
475
  *
@@ -486,93 +486,96 @@
486
  if( new_tick == vars.tick_count ) {
487
  new_tick = 0;
488
  }
489
-
490
  mtphr_dnt_rotator_update( new_tick );
491
 
492
- }, parseInt(settings.rotate_delay*1000));
493
  }
494
-
495
  /**
496
  * Create the rotator update call
497
  *
498
- * @since 1.0.0
499
  */
500
  function mtphr_dnt_rotator_update( new_tick ) {
501
-
502
- // Clear the interval
503
- if( settings.auto_rotate ) {
504
- clearInterval( ticker_delay );
505
- }
506
-
507
- // Trigger the before change callback
508
- settings.before_change.call( this, $ticker );
509
-
510
- // Set the running variable
511
- vars.running = 1;
512
-
513
- // Rotate the current tick out
514
- mtphr_dnt_rotator_out( new_tick );
515
-
516
- // Rotate the new tick in
517
- mtphr_dnt_rotator_in( new_tick );
518
-
519
- // Set the current tick
520
- vars.current_tick = new_tick;
521
-
522
- // Trigger the after change callback
523
- after_change_timeout = setTimeout( function() {
524
-
525
- settings.after_change.call( this, $ticker );
526
-
527
- // Reset the rotator type & variables
528
- rotate_adjustment = settings.rotate_type;
529
- vars.reverse = 0;
530
- vars.running = 0;
531
-
532
- // Restart the interval
533
- if( settings.auto_rotate ) {
534
- mtphr_dnt_rotator_delay();
535
  }
536
-
537
- }, parseInt(settings.rotate_speed*100) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
538
  }
539
-
540
  /**
541
  * Update the control links
542
  *
543
  * @since 1.0.0
544
  */
545
  function mtphr_dnt_rotator_update_links( new_tick ) {
546
-
547
  if( $nav_controls ) {
548
  $nav_controls.children('a').removeClass('active');
549
  $nav_controls.children('a[href="'+new_tick+'"]').addClass('active');
550
  }
551
  }
552
-
553
  /**
554
  * Create the rotator in function calls
555
  *
556
  * @since 1.0.0
557
  */
558
  function mtphr_dnt_rotator_in( new_tick ) {
559
-
560
  // Update the links
561
  mtphr_dnt_rotator_update_links( new_tick );
562
-
563
  // Find the rotation type and create the dynamic rotation in function
564
  var rotate_in_name = 'mtphr_dnt_rotator_'+rotate_adjustment+'_in';
565
  var mtphr_dnt_rotator_type_in = eval('('+rotate_in_name+')');
566
  mtphr_dnt_rotator_type_in( $ticker, $(ticks[new_tick]), $(ticks[vars.current_tick]), parseInt(settings.rotate_speed*100), settings.rotate_ease );
567
  }
568
-
569
  /**
570
  * Create the rotator out function calls
571
  *
572
  * @since 1.0.0
573
  */
574
  function mtphr_dnt_rotator_out( new_tick ) {
575
-
576
  // Find the rotation type and create the dynamic rotation out function
577
  var rotate_out_name = 'mtphr_dnt_rotator_'+rotate_adjustment+'_out';
578
  var mtphr_dnt_rotator_type_out = eval('('+rotate_out_name+')');
@@ -587,130 +590,130 @@
587
  function mtphr_dnt_rotator_resize_ticks() {
588
 
589
  for( var i=0; i<vars.tick_count; i++ ) {
590
-
591
  // Set the width of the tick
592
  $(ticks[i]).width( ticker_width+'px' );
593
  }
594
-
595
  // Resize the ticker
596
  var h = $(ticks[vars.current_tick]).outerHeight();
597
  $ticker.stop().css( 'height', h+'px' );
598
  }
599
-
600
-
601
-
602
-
603
  /**
604
  * Rotator fade scripts
605
  *
606
  * @since 1.0.0
607
  */
608
  function mtphr_dnt_rotator_fade_init( $ticker, ticks, rotate_speed, ease ) {
609
-
610
  // Get the first tick
611
  $tick = ticks[0];
612
-
613
  // Find the width of the tick
614
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
615
  var h = $tick.outerHeight();
616
-
617
  // Set the height of the ticker
618
  $ticker.css( 'height', h+'px' );
619
-
620
  // Set the initial position of the width & make sure it's visible
621
  $tick.show();
622
  }
623
-
624
  // Show the new tick
625
  function mtphr_dnt_rotator_fade_in( $ticker, $tick, $prev, rotate_speed, ease ) {
626
  $tick.fadeIn( rotate_speed );
627
-
628
  var h = $tick.outerHeight();
629
-
630
  // Resize the ticker
631
  $ticker.stop().animate( {
632
  height: h+'px'
633
  }, rotate_speed, ease, function() {
634
  });
635
  }
636
-
637
  // Hide the old tick
638
  function mtphr_dnt_rotator_fade_out( $ticker, $tick, $next, rotate_speed, ease ) {
639
  $tick.fadeOut( rotate_speed );
640
  }
641
-
642
-
643
-
644
-
645
  /**
646
  * Rotator slide left scripts
647
  *
648
  * @since 1.0.0
649
  */
650
  function mtphr_dnt_rotator_slide_left_init( $ticker, ticks, rotate_speed, ease ) {
651
-
652
  // Get the first tick
653
  $tick = ticks[0];
654
-
655
  // Find the dimensions of the tick
656
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
657
  var h = $tick.outerHeight();
658
-
659
  // Set the height of the ticker
660
  $ticker.css( 'height', h+'px' );
661
-
662
  // Set the initial position of the width & make sure it's visible
663
  $tick.css( 'left', 0 );
664
  $tick.show();
665
-
666
  // If there are any images, reset height after loading
667
  if( $tick.find('img').length > 0 ) {
668
-
669
  $tick.find('img').each( function(index) {
670
-
671
  jQuery(this).load( function() {
672
-
673
  // Find the height of the tick
674
  var h = $tick.outerHeight();
675
-
676
  // Set the height of the ticker
677
  $ticker.css( 'height', h+'px' );
678
- });
679
- });
680
  }
681
  }
682
-
683
  // Show the new tick
684
  function mtphr_dnt_rotator_slide_left_in( $ticker, $tick, $prev, rotate_speed, ease ) {
685
-
686
  // Find the dimensions of the tick
687
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
688
  var h = $tick.outerHeight();
689
-
690
  // Set the initial position of the width & make sure it's visible
691
  $tick.css( 'left', parseFloat(w+offset)+'px' );
692
  $tick.show();
693
-
694
  // Resize the ticker
695
  $ticker.stop().animate( {
696
  height: h+'px'
697
  }, rotate_speed, ease, function() {
698
  });
699
-
700
  // Slide the tick in
701
  $tick.stop().animate( {
702
  left: '0'
703
  }, rotate_speed, ease, function() {
704
  });
705
  }
706
-
707
  // Hide the old tick
708
  function mtphr_dnt_rotator_slide_left_out( $ticker, $tick, $next, rotate_speed, ease ) {
709
-
710
  // Find the dimensions of the tick
711
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
712
  var h = $tick.outerHeight();
713
-
714
  // Slide the tick in
715
  $tick.stop().animate( {
716
  left: '-'+parseFloat(w+offset)+'px'
@@ -719,79 +722,79 @@
719
  $tick.hide();
720
  });
721
  }
722
-
723
-
724
-
725
-
726
  /**
727
  * Rotator slide right scripts
728
  *
729
  * @since 1.0.0
730
  */
731
  function mtphr_dnt_rotator_slide_right_init( $ticker, ticks, rotate_speed, ease ) {
732
-
733
  // Get the first tick
734
  $tick = ticks[0];
735
-
736
  // Find the dimensions of the tick
737
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
738
  var h = $tick.outerHeight();
739
-
740
  // Set the height of the ticker
741
  $ticker.css( 'height', h+'px' );
742
-
743
  // Set the initial position of the width & make sure it's visible
744
  $tick.css( 'left', 0 );
745
  $tick.show();
746
-
747
  // If there are any images, reset height after loading
748
  if( $tick.find('img').length > 0 ) {
749
-
750
  $tick.find('img').each( function(index) {
751
-
752
  jQuery(this).load( function() {
753
-
754
  // Find the height of the tick
755
  var h = $tick.outerHeight();
756
-
757
  // Set the height of the ticker
758
  $ticker.css( 'height', h+'px' );
759
- });
760
- });
761
  }
762
  }
763
-
764
  // Show the new tick
765
  function mtphr_dnt_rotator_slide_right_in( $ticker, $tick, $prev, rotate_speed, ease ) {
766
-
767
  // Find the dimensions of the tick
768
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
769
  var h = $tick.outerHeight();
770
-
771
  // Set the initial position of the width & make sure it's visible
772
  $tick.css( 'left', '-'+parseFloat(w+offset)+'px' );
773
  $tick.show();
774
-
775
  // Resize the ticker
776
  $ticker.stop().animate( {
777
  height: h+'px'
778
  }, rotate_speed, ease, function() {
779
  });
780
-
781
  // Slide the tick in
782
  $tick.stop().animate( {
783
  left: '0'
784
  }, rotate_speed, ease, function() {
785
  });
786
  }
787
-
788
  // Hide the old tick
789
  function mtphr_dnt_rotator_slide_right_out( $ticker, $tick, $next, rotate_speed, ease ) {
790
-
791
  // Find the dimensions of the tick
792
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
793
  var h = $tick.outerHeight();
794
-
795
  // Slide the tick in
796
  $tick.stop().animate( {
797
  left: parseFloat(w+offset)+'px'
@@ -800,76 +803,76 @@
800
  $tick.hide();
801
  });
802
  }
803
-
804
-
805
-
806
-
807
  /**
808
  * Rotator slide down scripts
809
  *
810
  * @since 1.0.0
811
  */
812
  function mtphr_dnt_rotator_slide_down_init( $ticker, ticks, rotate_speed, ease ) {
813
-
814
  // Get the first tick
815
  $tick = ticks[0];
816
-
817
  // Find the height of the tick
818
  var h = $tick.outerHeight();
819
-
820
  // Set the height of the ticker
821
  $ticker.css( 'height', h+'px' );
822
-
823
  // Set the initial position of the width & make sure it's visible
824
  $tick.css( 'top', 0 );
825
  $tick.show();
826
-
827
  // If there are any images, reset height after loading
828
  if( $tick.find('img').length > 0 ) {
829
-
830
  $tick.find('img').each( function(index) {
831
-
832
  jQuery(this).load( function() {
833
-
834
  // Find the height of the tick
835
  var h = $tick.outerHeight();
836
-
837
  // Set the height of the ticker
838
  $ticker.css( 'height', h+'px' );
839
- });
840
- });
841
  }
842
  }
843
-
844
  // Show the new tick
845
  function mtphr_dnt_rotator_slide_down_in( $ticker, $tick, $prev, rotate_speed, ease ) {
846
-
847
  // Find the height of the tick
848
  var h = $tick.outerHeight();
849
-
850
  // Set the initial position of the width & make sure it's visible
851
  $tick.css( 'top', '-'+parseFloat(h+offset)+'px' );
852
  $tick.show();
853
-
854
  // Resize the ticker
855
  $ticker.stop().animate( {
856
  height: h+'px'
857
  }, rotate_speed, ease, function() {
858
  });
859
-
860
  // Slide the tick in
861
  $tick.stop().animate( {
862
  top: '0'
863
  }, rotate_speed, ease, function() {
864
  });
865
  }
866
-
867
  // Hide the old tick
868
  function mtphr_dnt_rotator_slide_down_out( $ticker, $tick, $next, rotate_speed, ease ) {
869
-
870
  // Find the height of the next tick
871
  var h = $next.outerHeight();
872
-
873
  // Slide the tick in
874
  $tick.stop().animate( {
875
  top: parseFloat(h+offset)+'px'
@@ -879,75 +882,75 @@
879
  });
880
  }
881
 
882
-
883
 
884
-
 
885
  /**
886
  * Rotator slide up scripts
887
  *
888
  * @since 1.0.0
889
  */
890
  function mtphr_dnt_rotator_slide_up_init( $ticker, ticks, rotate_speed, ease ) {
891
-
892
  // Get the first tick
893
  $tick = ticks[0];
894
-
895
  // Find the height of the tick
896
  var h = $tick.outerHeight();
897
-
898
  // Set the height of the ticker
899
  $ticker.css( 'height', h+'px' );
900
-
901
  // Set the initial position of the width & make sure it's visible
902
  $tick.css( 'top', 0 );
903
  $tick.show();
904
-
905
  // If there are any images, reset height after loading
906
  if( $tick.find('img').length > 0 ) {
907
-
908
  $tick.find('img').each( function(index) {
909
-
910
  jQuery(this).load( function() {
911
-
912
  // Find the height of the tick
913
  var h = $tick.outerHeight();
914
-
915
  // Set the height of the ticker
916
  $ticker.css( 'height', h+'px' );
917
- });
918
- });
919
  }
920
  }
921
-
922
  // Show the new tick
923
  function mtphr_dnt_rotator_slide_up_in( $ticker, $tick, $prev, rotate_speed, ease ) {
924
-
925
  // Find the height of the tick
926
  var h = $tick.outerHeight();
927
-
928
  // Set the initial position of the width & make sure it's visible
929
  $tick.css( 'top', parseFloat($prev.outerHeight()+offset)+'px' );
930
  $tick.show();
931
-
932
  // Resize the ticker
933
  $ticker.stop().animate( {
934
  height: h+'px'
935
  }, rotate_speed, ease, function() {
936
  });
937
-
938
  // Slide the tick in
939
  $tick.stop().animate( {
940
  top: '0'
941
  }, rotate_speed, ease, function() {
942
  });
943
  }
944
-
945
  // Hide the old tick
946
  function mtphr_dnt_rotator_slide_up_out( $ticker, $tick, $next, rotate_speed, ease ) {
947
-
948
  // Find the height of the next tick
949
  var h = $tick.outerHeight();
950
-
951
  // Slide the tick in
952
  $tick.stop().animate( {
953
  top: '-'+parseFloat(h+offset)+'px'
@@ -956,9 +959,9 @@
956
  $tick.hide();
957
  });
958
  }
959
-
960
-
961
-
962
 
963
  /**
964
  * Navigation clicks
@@ -966,12 +969,12 @@
966
  * @since 1.0.0
967
  */
968
  if( $nav_prev && settings.type == 'rotate' ) {
969
-
970
  $nav_prev.bind('click', function( e ) {
971
  e.preventDefault();
972
-
973
  if(vars.running) return false;
974
-
975
  // Find the new tick
976
  var new_tick = parseInt(vars.current_tick-1);
977
  if( new_tick < 0 ) {
@@ -989,26 +992,26 @@
989
  }
990
  vars.reverse = 1;
991
  }
992
- mtphr_dnt_rotator_update( new_tick );
993
  });
994
-
995
  $nav_next.bind('click', function(e) {
996
  e.preventDefault();
997
 
998
  if(vars.running) return false;
999
-
1000
  // Find the new tick
1001
  var new_tick = parseInt(vars.current_tick + 1);
1002
  if( new_tick == vars.tick_count ) {
1003
  new_tick = 0;
1004
  }
1005
- mtphr_dnt_rotator_update( new_tick );
1006
  });
1007
  }
1008
-
1009
-
1010
-
1011
-
1012
  /**
1013
  * Nav controls
1014
  *
@@ -1018,15 +1021,15 @@
1018
 
1019
  $nav_controls.children('a').bind('click', function( e ) {
1020
  e.preventDefault();
1021
-
1022
  // Find the new tick
1023
  var new_tick = parseInt( $(this).attr('href') );
1024
-
1025
  if(vars.running) return false;
1026
  if(new_tick == vars.current_tick) return false;
1027
-
1028
  var reverse = ( new_tick < vars.current_tick ) ? 1 : 0;
1029
-
1030
  if( settings.nav_reverse && reverse ) {
1031
  if( settings.rotate_type == 'slide_left' ) {
1032
  rotate_adjustment = 'slide_right';
@@ -1039,13 +1042,13 @@
1039
  }
1040
  vars.reverse = 1;
1041
  }
1042
- mtphr_dnt_rotator_update( new_tick );
1043
  });
1044
  }
1045
 
1046
 
1047
 
1048
-
1049
  /**
1050
  * Resize listener
1051
  * Reset the ticker width
@@ -1053,12 +1056,12 @@
1053
  * @since 1.0.9
1054
  */
1055
  $(window).resize( function() {
1056
-
1057
  // Resize the tickers if the width is different
1058
  if( $ticker.outerWidth() != ticker_width ) {
1059
-
1060
  ticker_width = $ticker.outerWidth();
1061
-
1062
  if( settings.type == 'scroll' ) {
1063
  if( settings.scroll_direction=='up' || settings.scroll_direction=='down' ) {
1064
  if( ticker_scroll_resize ) {
@@ -1068,7 +1071,7 @@
1068
  }
1069
  } else {
1070
  mtphr_dnt_scroll_resize_ticks();
1071
- }
1072
  } else if( settings.type == 'rotate' ) {
1073
  mtphr_dnt_rotator_resize_ticks();
1074
  }
@@ -1076,15 +1079,15 @@
1076
  });
1077
 
1078
 
1079
-
1080
-
1081
  // Trigger the afterLoad callback
1082
  settings.after_load.call(this, $ticker);
1083
 
1084
  });
1085
  }
1086
  };
1087
-
1088
 
1089
 
1090
 
@@ -1095,7 +1098,7 @@
1095
  * @since 1.0.0
1096
  */
1097
  $.fn.ditty_news_ticker = function( method ) {
1098
-
1099
  if ( methods[method] ) {
1100
  return methods[method].apply( this, Array.prototype.slice.call(arguments, 1) );
1101
  } else if ( typeof method === 'object' || !method ) {
@@ -1104,5 +1107,5 @@
1104
  $.error( 'Method ' + method + ' does not exist in ditty_news_ticker' );
1105
  }
1106
  };
1107
-
1108
  })( jQuery );
1
  /**
2
  * Ditty News Ticker
3
+ * Date: 6/12/2013
4
  *
5
  * @author Metaphor Creations
6
+ * @version 1.1.7
7
  *
8
  **/
9
 
10
  ( function($) {
11
+
12
  var methods = {
13
+
14
  init : function( options ) {
15
 
16
  return this.each( function(){
35
  after_change : function(){},
36
  after_load : function(){}
37
  };
38
+
39
  // Useful variables. Play carefully.
40
  var vars = {
41
  id : settings.id,
44
  reverse : 0,
45
  running : 0
46
  };
47
+
48
  // Add any set options
49
+ if (options) {
50
  $.extend(settings, options);
51
  }
52
 
53
  // Create variables
54
+ var $ticker = $(this).find('.mtphr-dnt-tick-contents'),
55
+ $nav_prev = $(this).find('.mtphr-dnt-nav-prev'),
56
+ $nav_next = $(this).find('.mtphr-dnt-nav-next'),
57
+ $nav_controls = $(this).find('.mtphr-dnt-control-links'),
58
+ ticker_width = $ticker.outerWidth(),
59
+ ticker_height = 0,
60
+ ticks = [],
61
+ ticker_scroll,
62
+ ticker_scroll_resize = true,
63
+ ticker_delay,
64
+ rotate_adjustment = settings.rotate_type,
65
+ after_change_timeout,
66
+ ticker_pause = false,
67
+ offset = 20,
68
+ touch_down_x,
69
+ touch_down_y,
70
+ touch_link = '',
71
+ touch_target = '';
72
 
73
  // Add the vars
74
  $ticker.data('ditty:vars', vars);
75
+
76
  // Save the tick count & total
77
  vars.tick_count = $ticker.find('.mtphr-dnt-tick').length;
78
 
82
  // Setup a ticker scroll
83
  if( settings.type == 'scroll' ) {
84
  mtphr_dnt_scroll_setup();
85
+
86
  // Setup a ticker rotator
87
  } else if( settings.type == 'rotate' ) {
88
  mtphr_dnt_rotator_setup();
89
+ }
90
  }
91
+
92
+
93
+
94
  /**
95
  * Setup the ticker scroll
96
  *
103
  var style = $first.attr('style');
104
  var style_array = style.split('width:');
105
  ticker_scroll_resize = (style_array.length > 1) ? false : true;
106
+ }
107
+
108
  // Loop through the tick items
109
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
110
+
111
  // Find the greatest tick height
112
  if( $(this).outerHeight() > ticker_height ) {
113
  ticker_height = $(this).outerHeight();
114
  }
115
+
116
  if( settings.scroll_direction == 'up' || settings.scroll_direction == 'down' ) {
117
  $(this).css('height', 'auto');
118
  }
119
  });
120
+
121
  // Set the ticker height
122
  $ticker.css('height',ticker_height+'px');
123
+
124
  // Loop through the tick items
125
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
126
+
127
  // Make sure the ticker is visible
128
  $(this).show();
129
+
130
  // Add the tick data
131
  var tick = [{'headline':$(this)}];
132
+
133
  // Add the tick to the array
134
  ticks.push(tick);
135
  });
136
+
137
  // Set the initial position of the ticks
138
  mtphr_dnt_scroll_reset_ticks();
139
+
140
  // Start the scroll loop
141
  mtphr_dnt_scroll_loop();
142
+
143
  // Clear the loop on mouse hover
144
  $ticker.hover(
145
  function () {
146
  if( settings.scroll_pause ) {
147
  clearInterval( ticker_scroll );
148
  }
149
+ },
150
  function () {
151
  if( settings.scroll_pause ) {
152
  mtphr_dnt_scroll_loop();
154
  }
155
  );
156
  }
157
+
158
  /**
159
  * Create the ticker scroll loop
160
  *
161
  * @since 1.0.8
162
  */
163
  function mtphr_dnt_scroll_loop() {
164
+
165
  // Start the ticker timer
166
  clearInterval( ticker_scroll );
167
  ticker_scroll = setInterval( function() {
168
 
169
  for( var i=0; i<vars.tick_count; i++ ) {
170
+
171
  if( ticks[i][0].visible == true ) {
172
+
173
  var pos = 'reset';
174
+
175
  if( settings.scroll_direction == 'left' || settings.scroll_direction == 'right' ) {
176
+
177
  pos = (settings.scroll_direction == 'left') ? mtphr_dnt_scroll_left(i) : mtphr_dnt_scroll_right(i);
178
  if( pos == 'reset' ) {
179
  pos = ticks[i][0].reset;
184
  }, 100, 'linear' );
185
  }
186
  } else {
187
+
188
  pos = (settings.scroll_direction == 'up') ? mtphr_dnt_scroll_up(i) : mtphr_dnt_scroll_down(i);
189
  if( pos == 'reset' ) {
190
  pos = ticks[i][0].reset;
195
  }, 100, 'linear' );
196
  }
197
  }
198
+
199
  ticks[i][0].position = pos;
200
  }
201
  }
202
+ }, 100);
203
  }
204
 
205
  /**
208
  * @since 1.0.0
209
  */
210
  function mtphr_dnt_scroll_left( i ) {
211
+
212
  // Find the new position
213
  var pos = parseFloat(ticks[i][0].position - settings.scroll_speed);
214
+
215
  // Reset the tick if off the screen
216
  if( pos < -(ticks[i][0].width+offset) ) {
217
  pos = mtphr_dnt_scroll_check_current(i);
218
  } else if( pos < parseFloat(ticker_width-ticks[i][0].width-settings.scroll_spacing) ) {
219
  mtphr_dnt_scroll_check_next(i);
220
  }
221
+
222
  return pos;
223
  }
224
+
225
  /**
226
  * Scroll the ticker right
227
  *
228
  * @since 1.0.0
229
  */
230
  function mtphr_dnt_scroll_right( i ) {
231
+
232
  // Find the new position
233
  var pos = ticks[i][0].position + settings.scroll_speed;
234
 
235
  // Reset the tick if off the screen
236
  if( pos > ticker_width+offset ) {
237
  pos = mtphr_dnt_scroll_check_current(i);
238
+ } else if( pos > settings.scroll_spacing ) {
239
  mtphr_dnt_scroll_check_next(i);
240
  }
241
+
242
  return pos;
243
  }
244
+
245
  /**
246
  * Scroll the ticker up
247
  *
248
  * @since 1.0.0
249
  */
250
  function mtphr_dnt_scroll_up( i ) {
251
+
252
  // Find the new position
253
  var pos = ticks[i][0].position - settings.scroll_speed;
254
 
255
  // Reset the tick if off the screen
256
  if( pos < -(ticks[i][0].height+offset) ) {
257
  pos = mtphr_dnt_scroll_check_current(i);
258
+ } else if( pos < ticker_height-ticks[i][0].height-settings.scroll_spacing ) {
259
  mtphr_dnt_scroll_check_next(i);
260
  }
261
+
262
  return pos;
263
  }
264
+
265
  /**
266
  * Scroll the ticker down
267
  *
268
  * @since 1.0.0
269
  */
270
  function mtphr_dnt_scroll_down( i ) {
271
+
272
  // Find the new position
273
  var pos = ticks[i][0].position + settings.scroll_speed;
274
 
275
  // Reset the tick if off the screen
276
  if( pos > ticker_height+offset ) {
277
  pos = mtphr_dnt_scroll_check_current(i);
278
+ } else if( pos > settings.scroll_spacing ) {
279
  mtphr_dnt_scroll_check_next(i);
280
  }
281
+
282
  return pos;
283
  }
284
+
285
  /**
286
  * Check the current tick position
287
  *
288
  * @since 1.0.0
289
  */
290
  function mtphr_dnt_scroll_check_current( i ) {
291
+
292
  if( vars.tick_count > 1 ) {
293
  ticks[i][0].visible = false;
294
  }
295
+
296
  return 'reset';
297
  }
298
+
299
  /**
300
  * Check the next tick visibility
301
  *
302
  * @since 1.0.0
303
  */
304
  function mtphr_dnt_scroll_check_next( i ) {
305
+
306
  if( i==(vars.tick_count-1) ) {
307
  ticks[0][0].visible = true;
308
  } else {
309
  ticks[(i+1)][0].visible = true;
310
  }
311
  }
312
+
313
  /**
314
  * Resize the scroll ticks
315
  *
318
  function mtphr_dnt_scroll_resize_ticks() {
319
 
320
  for( var i=0; i<vars.tick_count; i++ ) {
321
+
322
  // Set the tick position
323
  var position;
324
+
325
  var $tick = ticks[i][0].headline;
326
+
327
  switch( settings.scroll_direction ) {
328
  case 'left':
329
  position = ticker_width+offset;
331
  $tick.css('left',position+'px');
332
  }
333
  break;
334
+
335
  case 'right':
336
  position = parseInt('-'+($tick.outerWidth()+offset));
337
  if( ticks[i][0].visible == false ) {
338
  $tick.css('left',position+'px');
339
  }
340
  break;
341
+
342
  case 'up':
343
  if( ticker_scroll_resize ) {
344
  $tick.css('width',ticker_width);
348
  $tick.css('top',position+'px');
349
  }
350
  break;
351
+
352
  case 'down':
353
  if( ticker_scroll_resize ) {
354
  $tick.css('width',ticker_width);
359
  }
360
  break;
361
  }
362
+
363
  // Adjust the tick data
364
  ticks[i][0].width = $tick.outerWidth();
365
  ticks[i][0].height = $tick.outerHeight();
369
  ticks[i][0].reset = position;
370
  }
371
  }
372
+
373
  /**
374
  * Reset the scroller for vertical scrolls
375
  *
378
  function mtphr_dnt_scroll_reset_ticks() {
379
 
380
  for( var i=0; i<vars.tick_count; i++ ) {
381
+
382
  var $tick = ticks[i][0].headline;
383
+
384
  switch( settings.scroll_direction ) {
385
  case 'left':
386
  position = ticker_width+offset;
387
+ $tick.stop(true,true).css('left',position+'px');
388
  break;
389
+
390
  case 'right':
391
  position = parseInt('-'+($tick.outerWidth()+offset));
392
+ $tick.stop(true,true).css('left',position+'px');
393
  break;
394
+
395
  case 'up':
396
  if( ticker_scroll_resize ) {
397
  $tick.css('width',ticker_width);
398
  }
399
  position = parseInt(ticker_height+offset);
400
+ $tick.stop(true,true).css('top',position+'px');
401
  break;
402
+
403
  case 'down':
404
  if( ticker_scroll_resize ) {
405
  $tick.css('width',ticker_width);
406
  }
407
  position = parseInt('-'+($tick.outerHeight()+offset));
408
+ $tick.stop(true,true).css('top',position+'px');
409
  break;
410
  }
411
+
412
  ticks[i][0].width = $tick.outerWidth();
413
  ticks[i][0].height = $tick.outerHeight();
414
  ticks[i][0].position = position;
415
  ticks[i][0].reset = position;
416
  ticks[i][0].visible = false;
417
+
418
  // Reset the current tick
419
  vars.current_tick = 0;
420
+
421
  // Set the first tick visibility
422
+ ticks[vars.current_tick][0].visible = true;
423
  }
424
  }
425
+
426
+
427
+
428
+
429
  /**
430
  * Setup the ticker rotator
431
  *
435
 
436
  // Loop through the tick items
437
  $ticker.find('.mtphr-dnt-tick').each( function(index) {
438
+
439
  // Add the tick to the array
440
  ticks.push($(this));
441
+
442
  });
443
 
444
  // Resize the ticks
445
  mtphr_dnt_rotator_resize_ticks();
446
+
447
  // Find the rotation type and create the dynamic rotation init function
448
  var rotate_init_name = 'mtphr_dnt_rotator_'+settings.rotate_type+'_init';
449
  var mtphr_dnt_rotator_type_init = eval('('+rotate_init_name+')');
450
  mtphr_dnt_rotator_type_init( $ticker, ticks, parseInt(settings.rotate_speed*100), settings.rotate_ease );
451
  mtphr_dnt_rotator_update_links( 0 );
452
+
453
  // Start the rotator rotate
454
  if( settings.auto_rotate ) {
455
  mtphr_dnt_rotator_delay();
456
  }
457
+
458
  // Clear the loop on mouse hover
459
  $ticker.hover(
460
  function (e) {
461
  if( settings.auto_rotate && settings.rotate_pause && !vars.running ) {
462
  clearInterval( ticker_delay );
463
  }
464
+ },
465
  function () {
466
  if( settings.auto_rotate && settings.rotate_pause && !vars.running ) {
467
  mtphr_dnt_rotator_delay();
469
  }
470
  );
471
  }
472
+
473
  /**
474
  * Create the ticker rotator loop
475
  *
486
  if( new_tick == vars.tick_count ) {
487
  new_tick = 0;
488
  }
489
+
490
  mtphr_dnt_rotator_update( new_tick );
491
 
492
+ }, parseInt(settings.rotate_delay*1000));
493
  }
494
+
495
  /**
496
  * Create the rotator update call
497
  *
498
+ * @since 1.1.7
499
  */
500
  function mtphr_dnt_rotator_update( new_tick ) {
501
+
502
+ if( vars.current_tick != new_tick ) {
503
+
504
+ // Clear the interval
505
+ if( settings.auto_rotate ) {
506
+ clearInterval( ticker_delay );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
507
  }
508
+
509
+ // Trigger the before change callback
510
+ settings.before_change.call( this, $ticker );
511
+
512
+ // Set the running variable
513
+ vars.running = 1;
514
+
515
+ // Rotate the current tick out
516
+ mtphr_dnt_rotator_out( new_tick );
517
+
518
+ // Rotate the new tick in
519
+ mtphr_dnt_rotator_in( new_tick );
520
+
521
+ // Set the current tick
522
+ vars.current_tick = new_tick;
523
+
524
+ // Trigger the after change callback
525
+ after_change_timeout = setTimeout( function() {
526
+
527
+ settings.after_change.call( this, $ticker );
528
+
529
+ // Reset the rotator type & variables
530
+ rotate_adjustment = settings.rotate_type;
531
+ vars.reverse = 0;
532
+ vars.running = 0;
533
+
534
+ // Restart the interval
535
+ if( settings.auto_rotate ) {
536
+ mtphr_dnt_rotator_delay();
537
+ }
538
+
539
+ }, parseInt(settings.rotate_speed*100) );
540
+ }
541
  }
542
+
543
  /**
544
  * Update the control links
545
  *
546
  * @since 1.0.0
547
  */
548
  function mtphr_dnt_rotator_update_links( new_tick ) {
549
+
550
  if( $nav_controls ) {
551
  $nav_controls.children('a').removeClass('active');
552
  $nav_controls.children('a[href="'+new_tick+'"]').addClass('active');
553
  }
554
  }
555
+
556
  /**
557
  * Create the rotator in function calls
558
  *
559
  * @since 1.0.0
560
  */
561
  function mtphr_dnt_rotator_in( new_tick ) {
562
+
563
  // Update the links
564
  mtphr_dnt_rotator_update_links( new_tick );
565
+
566
  // Find the rotation type and create the dynamic rotation in function
567
  var rotate_in_name = 'mtphr_dnt_rotator_'+rotate_adjustment+'_in';
568
  var mtphr_dnt_rotator_type_in = eval('('+rotate_in_name+')');
569
  mtphr_dnt_rotator_type_in( $ticker, $(ticks[new_tick]), $(ticks[vars.current_tick]), parseInt(settings.rotate_speed*100), settings.rotate_ease );
570
  }
571
+
572
  /**
573
  * Create the rotator out function calls
574
  *
575
  * @since 1.0.0
576
  */
577
  function mtphr_dnt_rotator_out( new_tick ) {
578
+
579
  // Find the rotation type and create the dynamic rotation out function
580
  var rotate_out_name = 'mtphr_dnt_rotator_'+rotate_adjustment+'_out';
581
  var mtphr_dnt_rotator_type_out = eval('('+rotate_out_name+')');
590
  function mtphr_dnt_rotator_resize_ticks() {
591
 
592
  for( var i=0; i<vars.tick_count; i++ ) {
593
+
594
  // Set the width of the tick
595
  $(ticks[i]).width( ticker_width+'px' );
596
  }
597
+
598
  // Resize the ticker
599
  var h = $(ticks[vars.current_tick]).outerHeight();
600
  $ticker.stop().css( 'height', h+'px' );
601
  }
602
+
603
+
604
+
605
+
606
  /**
607
  * Rotator fade scripts
608
  *
609
  * @since 1.0.0
610
  */
611
  function mtphr_dnt_rotator_fade_init( $ticker, ticks, rotate_speed, ease ) {
612
+
613
  // Get the first tick
614
  $tick = ticks[0];
615
+
616
  // Find the width of the tick
617
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
618
  var h = $tick.outerHeight();
619
+
620
  // Set the height of the ticker
621
  $ticker.css( 'height', h+'px' );
622
+
623
  // Set the initial position of the width & make sure it's visible
624
  $tick.show();
625
  }
626
+
627
  // Show the new tick
628
  function mtphr_dnt_rotator_fade_in( $ticker, $tick, $prev, rotate_speed, ease ) {
629
  $tick.fadeIn( rotate_speed );
630
+
631
  var h = $tick.outerHeight();
632
+
633
  // Resize the ticker
634
  $ticker.stop().animate( {
635
  height: h+'px'
636
  }, rotate_speed, ease, function() {
637
  });
638
  }
639
+
640
  // Hide the old tick
641
  function mtphr_dnt_rotator_fade_out( $ticker, $tick, $next, rotate_speed, ease ) {
642
  $tick.fadeOut( rotate_speed );
643
  }
644
+
645
+
646
+
647
+
648
  /**
649
  * Rotator slide left scripts
650
  *
651
  * @since 1.0.0
652
  */
653
  function mtphr_dnt_rotator_slide_left_init( $ticker, ticks, rotate_speed, ease ) {
654
+
655
  // Get the first tick
656
  $tick = ticks[0];
657
+
658
  // Find the dimensions of the tick
659
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
660
  var h = $tick.outerHeight();
661
+
662
  // Set the height of the ticker
663
  $ticker.css( 'height', h+'px' );
664
+
665
  // Set the initial position of the width & make sure it's visible
666
  $tick.css( 'left', 0 );
667
  $tick.show();
668
+
669
  // If there are any images, reset height after loading
670
  if( $tick.find('img').length > 0 ) {
671
+
672
  $tick.find('img').each( function(index) {
673
+
674
  jQuery(this).load( function() {
675
+
676
  // Find the height of the tick
677
  var h = $tick.outerHeight();
678
+
679
  // Set the height of the ticker
680
  $ticker.css( 'height', h+'px' );
681
+ });
682
+ });
683
  }
684
  }
685
+
686
  // Show the new tick
687
  function mtphr_dnt_rotator_slide_left_in( $ticker, $tick, $prev, rotate_speed, ease ) {
688
+
689
  // Find the dimensions of the tick
690
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
691
  var h = $tick.outerHeight();
692
+
693
  // Set the initial position of the width & make sure it's visible
694
  $tick.css( 'left', parseFloat(w+offset)+'px' );
695
  $tick.show();
696
+
697
  // Resize the ticker
698
  $ticker.stop().animate( {
699
  height: h+'px'
700
  }, rotate_speed, ease, function() {
701
  });
702
+
703
  // Slide the tick in
704
  $tick.stop().animate( {
705
  left: '0'
706
  }, rotate_speed, ease, function() {
707
  });
708
  }
709
+
710
  // Hide the old tick
711
  function mtphr_dnt_rotator_slide_left_out( $ticker, $tick, $next, rotate_speed, ease ) {
712
+
713
  // Find the dimensions of the tick
714
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
715
  var h = $tick.outerHeight();
716
+
717
  // Slide the tick in
718
  $tick.stop().animate( {
719
  left: '-'+parseFloat(w+offset)+'px'
722
  $tick.hide();
723
  });
724
  }
725
+
726
+
727
+
728
+
729
  /**
730
  * Rotator slide right scripts
731
  *
732
  * @since 1.0.0
733
  */
734
  function mtphr_dnt_rotator_slide_right_init( $ticker, ticks, rotate_speed, ease ) {
735
+
736
  // Get the first tick
737
  $tick = ticks[0];
738
+
739
  // Find the dimensions of the tick
740
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
741
  var h = $tick.outerHeight();
742
+
743
  // Set the height of the ticker
744
  $ticker.css( 'height', h+'px' );
745
+
746
  // Set the initial position of the width & make sure it's visible
747
  $tick.css( 'left', 0 );
748
  $tick.show();
749
+
750
  // If there are any images, reset height after loading
751
  if( $tick.find('img').length > 0 ) {
752
+
753
  $tick.find('img').each( function(index) {
754
+
755
  jQuery(this).load( function() {
756
+
757
  // Find the height of the tick
758
  var h = $tick.outerHeight();
759
+
760
  // Set the height of the ticker
761
  $ticker.css( 'height', h+'px' );
762
+ });
763
+ });
764
  }
765
  }
766
+
767
  // Show the new tick
768
  function mtphr_dnt_rotator_slide_right_in( $ticker, $tick, $prev, rotate_speed, ease ) {
769
+
770
  // Find the dimensions of the tick
771
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
772
  var h = $tick.outerHeight();
773
+
774
  // Set the initial position of the width & make sure it's visible
775
  $tick.css( 'left', '-'+parseFloat(w+offset)+'px' );
776
  $tick.show();
777
+
778
  // Resize the ticker
779
  $ticker.stop().animate( {
780
  height: h+'px'
781
  }, rotate_speed, ease, function() {
782
  });
783
+
784
  // Slide the tick in
785
  $tick.stop().animate( {
786
  left: '0'
787
  }, rotate_speed, ease, function() {
788
  });
789
  }
790
+
791
  // Hide the old tick
792
  function mtphr_dnt_rotator_slide_right_out( $ticker, $tick, $next, rotate_speed, ease ) {
793
+
794
  // Find the dimensions of the tick
795
  var w = $tick.parents('.mtphr-dnt-rotate').outerWidth();
796
  var h = $tick.outerHeight();
797
+
798
  // Slide the tick in
799
  $tick.stop().animate( {
800
  left: parseFloat(w+offset)+'px'
803
  $tick.hide();
804
  });
805
  }
806
+
807
+
808
+
809
+
810
  /**
811
  * Rotator slide down scripts
812
  *
813
  * @since 1.0.0
814
  */
815
  function mtphr_dnt_rotator_slide_down_init( $ticker, ticks, rotate_speed, ease ) {
816
+
817
  // Get the first tick
818
  $tick = ticks[0];
819
+
820
  // Find the height of the tick
821
  var h = $tick.outerHeight();
822
+
823
  // Set the height of the ticker
824
  $ticker.css( 'height', h+'px' );
825
+
826
  // Set the initial position of the width & make sure it's visible
827
  $tick.css( 'top', 0 );
828
  $tick.show();
829
+
830
  // If there are any images, reset height after loading
831
  if( $tick.find('img').length > 0 ) {
832
+
833
  $tick.find('img').each( function(index) {
834
+
835
  jQuery(this).load( function() {
836
+
837
  // Find the height of the tick
838
  var h = $tick.outerHeight();
839
+
840
  // Set the height of the ticker
841
  $ticker.css( 'height', h+'px' );
842
+ });
843
+ });
844
  }
845
  }
846
+
847
  // Show the new tick
848
  function mtphr_dnt_rotator_slide_down_in( $ticker, $tick, $prev, rotate_speed, ease ) {
849
+
850
  // Find the height of the tick
851
  var h = $tick.outerHeight();
852
+
853
  // Set the initial position of the width & make sure it's visible
854
  $tick.css( 'top', '-'+parseFloat(h+offset)+'px' );
855
  $tick.show();
856
+
857
  // Resize the ticker
858
  $ticker.stop().animate( {
859
  height: h+'px'
860
  }, rotate_speed, ease, function() {
861
  });
862
+
863
  // Slide the tick in
864
  $tick.stop().animate( {
865
  top: '0'
866
  }, rotate_speed, ease, function() {
867
  });
868
  }
869
+
870
  // Hide the old tick
871
  function mtphr_dnt_rotator_slide_down_out( $ticker, $tick, $next, rotate_speed, ease ) {
872
+
873
  // Find the height of the next tick
874
  var h = $next.outerHeight();
875
+
876
  // Slide the tick in
877
  $tick.stop().animate( {
878
  top: parseFloat(h+offset)+'px'
882
  });
883
  }
884
 
 
885
 
886
+
887
+
888
  /**
889
  * Rotator slide up scripts
890
  *
891
  * @since 1.0.0
892
  */
893
  function mtphr_dnt_rotator_slide_up_init( $ticker, ticks, rotate_speed, ease ) {
894
+
895
  // Get the first tick
896
  $tick = ticks[0];
897
+
898
  // Find the height of the tick
899
  var h = $tick.outerHeight();
900
+
901
  // Set the height of the ticker
902
  $ticker.css( 'height', h+'px' );
903
+
904
  // Set the initial position of the width & make sure it's visible
905
  $tick.css( 'top', 0 );
906
  $tick.show();
907
+
908
  // If there are any images, reset height after loading
909
  if( $tick.find('img').length > 0 ) {
910
+
911
  $tick.find('img').each( function(index) {
912
+
913
  jQuery(this).load( function() {
914
+
915
  // Find the height of the tick
916
  var h = $tick.outerHeight();
917
+
918
  // Set the height of the ticker
919
  $ticker.css( 'height', h+'px' );
920
+ });
921
+ });
922
  }
923
  }
924
+
925
  // Show the new tick
926
  function mtphr_dnt_rotator_slide_up_in( $ticker, $tick, $prev, rotate_speed, ease ) {
927
+
928
  // Find the height of the tick
929
  var h = $tick.outerHeight();
930
+
931
  // Set the initial position of the width & make sure it's visible
932
  $tick.css( 'top', parseFloat($prev.outerHeight()+offset)+'px' );
933
  $tick.show();
934
+
935
  // Resize the ticker
936
  $ticker.stop().animate( {
937
  height: h+'px'
938
  }, rotate_speed, ease, function() {
939
  });
940
+
941
  // Slide the tick in
942
  $tick.stop().animate( {
943
  top: '0'
944
  }, rotate_speed, ease, function() {
945
  });
946
  }
947
+
948
  // Hide the old tick
949
  function mtphr_dnt_rotator_slide_up_out( $ticker, $tick, $next, rotate_speed, ease ) {
950
+
951
  // Find the height of the next tick
952
  var h = $tick.outerHeight();
953
+
954
  // Slide the tick in
955
  $tick.stop().animate( {
956
  top: '-'+parseFloat(h+offset)+'px'
959
  $tick.hide();
960
  });
961
  }
962
+
963
+
964
+
965
 
966
  /**
967
  * Navigation clicks
969
  * @since 1.0.0
970
  */
971
  if( $nav_prev && settings.type == 'rotate' ) {
972
+
973
  $nav_prev.bind('click', function( e ) {
974
  e.preventDefault();
975
+
976
  if(vars.running) return false;
977
+
978
  // Find the new tick
979
  var new_tick = parseInt(vars.current_tick-1);
980
  if( new_tick < 0 ) {
992
  }
993
  vars.reverse = 1;
994
  }
995
+ mtphr_dnt_rotator_update( new_tick );
996
  });
997
+
998
  $nav_next.bind('click', function(e) {
999
  e.preventDefault();
1000
 
1001
  if(vars.running) return false;
1002
+
1003
  // Find the new tick
1004
  var new_tick = parseInt(vars.current_tick + 1);
1005
  if( new_tick == vars.tick_count ) {
1006
  new_tick = 0;
1007
  }
1008
+ mtphr_dnt_rotator_update( new_tick );
1009
  });
1010
  }
1011
+
1012
+
1013
+
1014
+
1015
  /**
1016
  * Nav controls
1017
  *
1021
 
1022
  $nav_controls.children('a').bind('click', function( e ) {
1023
  e.preventDefault();
1024
+
1025
  // Find the new tick
1026
  var new_tick = parseInt( $(this).attr('href') );
1027
+
1028
  if(vars.running) return false;
1029
  if(new_tick == vars.current_tick) return false;
1030
+
1031
  var reverse = ( new_tick < vars.current_tick ) ? 1 : 0;
1032
+
1033
  if( settings.nav_reverse && reverse ) {
1034
  if( settings.rotate_type == 'slide_left' ) {
1035
  rotate_adjustment = 'slide_right';
1042
  }
1043
  vars.reverse = 1;
1044
  }
1045
+ mtphr_dnt_rotator_update( new_tick );
1046
  });
1047
  }
1048
 
1049
 
1050
 
1051
+
1052
  /**
1053
  * Resize listener
1054
  * Reset the ticker width
1056
  * @since 1.0.9
1057
  */
1058
  $(window).resize( function() {
1059
+
1060
  // Resize the tickers if the width is different
1061
  if( $ticker.outerWidth() != ticker_width ) {
1062
+
1063
  ticker_width = $ticker.outerWidth();
1064
+
1065
  if( settings.type == 'scroll' ) {
1066
  if( settings.scroll_direction=='up' || settings.scroll_direction=='down' ) {
1067
  if( ticker_scroll_resize ) {
1071
  }
1072
  } else {
1073
  mtphr_dnt_scroll_resize_ticks();
1074
+ }
1075
  } else if( settings.type == 'rotate' ) {
1076
  mtphr_dnt_rotator_resize_ticks();
1077
  }
1079
  });
1080
 
1081
 
1082
+
1083
+
1084
  // Trigger the afterLoad callback
1085
  settings.after_load.call(this, $ticker);
1086
 
1087
  });
1088
  }
1089
  };
1090
+
1091
 
1092
 
1093
 
1098
  * @since 1.0.0
1099
  */
1100
  $.fn.ditty_news_ticker = function( method ) {
1101
+
1102
  if ( methods[method] ) {
1103
  return methods[method].apply( this, Array.prototype.slice.call(arguments, 1) );
1104
  } else if ( typeof method === 'object' || !method ) {
1107
  $.error( 'Method ' + method + ' does not exist in ditty_news_ticker' );
1108
  }
1109
  };
1110
+
1111
  })( jQuery );
ditty-news-ticker.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Ditty News Ticker
4
  Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
- Version: 1.1.6
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
@@ -45,9 +45,9 @@ The icons are licensed under a Creative Commons Attribution
45
  * @since 1.1.6
46
  */
47
  if ( WP_DEBUG ) {
48
- define ( 'MTPHR_DNT_VERSION', '1.1.6-'.time() );
49
  } else {
50
- define ( 'MTPHR_DNT_VERSION', '1.1.6' );
51
  }
52
  define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
53
  define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
3
  Plugin Name: Ditty News Ticker
4
  Plugin URI: http://dittynewsticker.com/
5
  Description: Ditty News Ticker is a multi-functional data display plugin
6
+ Version: 1.1.7
7
  Author: Metaphor Creations
8
  Author URI: http://www.metaphorcreations.com
9
  License: GPL2
45
  * @since 1.1.6
46
  */
47
  if ( WP_DEBUG ) {
48
+ define ( 'MTPHR_DNT_VERSION', '1.1.7-'.time() );
49
  } else {
50
+ define ( 'MTPHR_DNT_VERSION', '1.1.7' );
51
  }
52
  define ( 'MTPHR_DNT_DIR', plugin_dir_path(__FILE__) );
53
  define ( 'MTPHR_DNT_URL', plugins_url().'/ditty-news-ticker' );
includes/functions.php CHANGED
@@ -22,7 +22,7 @@ function ditty_news_ticker( $id='', $class='', $atts=false ) {
22
  /**
23
  * Return the ticker
24
  *
25
- * @since 1.1.6
26
  */
27
  function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
28
 
@@ -148,6 +148,7 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
148
  // Open the ticker container
149
  do_action( 'mtphr_dnt_before', $id, $meta_data );
150
  echo '<div class="mtphr-dnt-tick-container"'.$container_style.'>';
 
151
  do_action( 'mtphr_dnt_top', $id, $meta_data );
152
 
153
  // Print out the ticks
@@ -172,25 +173,25 @@ function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
172
  echo '</div>';
173
  do_action( 'mtphr_dnt_tick_after', $id, $meta_data, $total, $i );
174
  }
 
175
 
176
- // Add the directional nav
177
- if( $_mtphr_dnt_mode == 'rotate' ) {
178
- if( isset($_mtphr_dnt_rotate_directional_nav) ) {
179
- if( $_mtphr_dnt_rotate_directional_nav ) {
180
-
181
- $hide = '';
182
- if( isset($_mtphr_dnt_rotate_directional_nav_hide) ) {
183
- $hide = $_mtphr_dnt_rotate_directional_nav_hide ? ' mtphr-dnt-nav-hide' : '';
184
- }
185
- echo '<a class="mtphr-dnt-nav mtphr-dnt-nav-prev'.$hide.'" href="#" rel="nofollow">'.apply_filters( 'mtphr_dnt_direction_nav_prev', '' ).'</a>';
186
- echo '<a class="mtphr-dnt-nav mtphr-dnt-nav-next'.$hide.'" href="#" rel="nofollow">'.apply_filters( 'mtphr_dnt_direction_nav_next', '' ).'</a>';
187
  }
 
 
188
  }
189
  }
190
  }
191
-
192
- // Close the ticker container
193
- do_action( 'mtphr_dnt_bottom', $id, $meta_data );
194
  echo '</div>';
195
  do_action( 'mtphr_dnt_after', $id, $meta_data );
196
 
22
  /**
23
  * Return the ticker
24
  *
25
+ * @since 1.1.7
26
  */
27
  function get_mtphr_dnt_ticker( $id='', $class='', $atts=false ) {
28
 
148
  // Open the ticker container
149
  do_action( 'mtphr_dnt_before', $id, $meta_data );
150
  echo '<div class="mtphr-dnt-tick-container"'.$container_style.'>';
151
+ echo '<div class="mtphr-dnt-tick-contents">';
152
  do_action( 'mtphr_dnt_top', $id, $meta_data );
153
 
154
  // Print out the ticks
173
  echo '</div>';
174
  do_action( 'mtphr_dnt_tick_after', $id, $meta_data, $total, $i );
175
  }
176
+ }
177
 
178
+ // Close the ticker container
179
+ do_action( 'mtphr_dnt_bottom', $id, $meta_data );
180
+ echo '</div>';
181
+ // Add the directional nav
182
+ if( is_array($dnt_ticks) && $_mtphr_dnt_mode == 'rotate' ) {
183
+ if( isset($_mtphr_dnt_rotate_directional_nav) ) {
184
+ if( $_mtphr_dnt_rotate_directional_nav ) {
185
+
186
+ $hide = '';
187
+ if( isset($_mtphr_dnt_rotate_directional_nav_hide) ) {
188
+ $hide = $_mtphr_dnt_rotate_directional_nav_hide ? ' mtphr-dnt-nav-hide' : '';
189
  }
190
+ echo '<a class="mtphr-dnt-nav mtphr-dnt-nav-prev'.$hide.'" href="#" rel="nofollow">'.apply_filters( 'mtphr_dnt_direction_nav_prev', '' ).'</a>';
191
+ echo '<a class="mtphr-dnt-nav mtphr-dnt-nav-next'.$hide.'" href="#" rel="nofollow">'.apply_filters( 'mtphr_dnt_direction_nav_next', '' ).'</a>';
192
  }
193
  }
194
  }
 
 
 
195
  echo '</div>';
196
  do_action( 'mtphr_dnt_after', $id, $meta_data );
197
 
readme.txt CHANGED
@@ -52,6 +52,9 @@ Each individual Ticker post has multiple settings to customize.
52
 
53
  == Changelog ==
54
 
 
 
 
55
  = 1.1.6 =
56
  * Fixed pause on hover functionality.
57
 
@@ -131,6 +134,9 @@ Each individual Ticker post has multiple settings to customize.
131
 
132
  == Upgrade Notice ==
133
 
 
 
 
134
  = 1.1.6 =
135
  Fixed pause on hover functionality.
136
 
52
 
53
  == Changelog ==
54
 
55
+ = 1.1.7 =
56
+ * Modified structure & CSS to move the rotate navigation up a level.
57
+
58
  = 1.1.6 =
59
  * Fixed pause on hover functionality.
60
 
134
 
135
  == Upgrade Notice ==
136
 
137
+ = 1.1.7 =
138
+ Modified structure & CSS to move the rotate navigation up a level.
139
+
140
  = 1.1.6 =
141
  Fixed pause on hover functionality.
142