function theme_views_slideshow_div_js in Views Slideshow 6
Same name and namespace in other branches
- 5 views_slideshow.module \theme_views_slideshow_div_js()
This inline js sets up the timer for this slideshow.
3 theme calls to theme_views_slideshow_div_js()
- views-slideshow-single-frame.tpl.php in ./
views-slideshow-single-frame.tpl.php - views-slideshow-thumbnail-hover.tpl.php in ./
views-slideshow-thumbnail-hover.tpl.php - views-slideshow-thumbnailhover.tpl.php in contrib/
views_slideshow_thumbnailhover/ views-slideshow-thumbnailhover.tpl.php
File
- ./
views_slideshow.theme.inc, line 6
Code
function theme_views_slideshow_div_js($rows, $options, $id) {
$hover = 'hover';
if ($options['hover'] == 'hoverIntent') {
if (module_exists('jq')) {
$hover = jq_add('hoverIntent') ? 'hoverIntent' : 'hover';
}
else {
if (module_exists('hoverintent')) {
$hover = hoverintent_add() ? 'hoverIntent' : 'hover';
}
}
}
$num_divs = sizeof($rows);
$fade = $options['fade'] ? 'true' : 'false';
$js = <<<JS
// Set the timer data for a view slideshow.
\$(document).ready(function() {
// These are the divs containing the elements to be displayed in the main div in rotation or mouseover.
slideshow_data["{<span class="php-variable">$id</span>}"] = new views_slideshow_data({<span class="php-variable">$num_divs</span>}, {<span class="php-variable">$options</span>[<span class="php-string">'timer_delay'</span>]}, {<span class="php-variable">$options</span>[<span class="php-string">'sort'</span>]}, {<span class="php-variable">$fade</span>}, "{<span class="php-variable">$options</span>[<span class="php-string">'fade_speed'</span>]}", {<span class="php-variable">$options</span>[<span class="php-string">'fade_value'</span>]});
// This turns on the timer.
views_slideshow_timer("{<span class="php-variable">$id</span>}", true);
// This sets up the mouseover & mouseout to pause on the main element.
\$("#views_slideshow_main_{<span class="php-variable">$id</span>}").{<span class="php-variable">$hover</span>}(
function() {
views_slideshow_pause("{<span class="php-variable">$id</span>}");
},
function() {
views_slideshow_resume("{<span class="php-variable">$id</span>}");
});
});
JS;
return $js;
}