-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
35 lines (29 loc) · 1.65 KB
/
scripts.js
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
jQuery( document ).ready( function( $ ) {
$.each( $( '.useful_banner_manager_banners_rotation' ), function() {
if ( $( this ).find( '.useful_banner_manager_rotating_banner' ).length > 1 ) {
var banners_rotation_block = $( this );
var interval = 1000 + $( this ).data( 'interval' );
setTimeout( function() { useful_banner_manager_rotate_banners( banners_rotation_block, interval ) }, interval );
}
} );
} );
function useful_banner_manager_rotate_banners( banners_rotation_block, interval ) {
jQuery ( function( $ ) {
$.each( $( banners_rotation_block ).find( '.useful_banner_manager_rotating_banner' ), function() {
if ( $( this ).css( 'display' ) != 'none' ) {
if ( $( this ).next().html() != null ) {
$( this ).fadeOut( 1000, function() {
var next_banner_id = $( this ).next().data( 'banner-id' );
$( this ).next().fadeIn( 1000 );
} );
} else {
$( banners_rotation_block ).find( '.useful_banner_manager_rotating_banner:last' ).fadeOut( 1000, function() {
var next_banner_id = $( banners_rotation_block ).find( '.useful_banner_manager_rotating_banner:first' ).data( 'banner-id' );
$( banners_rotation_block ).find( '.useful_banner_manager_rotating_banner:first' ).fadeIn( 1000 );
} );
}
}
} );
} );
setTimeout( function() { useful_banner_manager_rotate_banners( banners_rotation_block, interval ) }, interval );
}