forked from stackboxcms/stackboxcms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slideshow: Updated to use jCycle Lite
- Loading branch information
Showing
5 changed files
with
43 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
app/www/content/Module/Slideshow/assets/scripts/jquery.cycle.lite.min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
app/www/content/Module/Slideshow/assets/scripts/jquery.slides.min.js
This file was deleted.
Oops, something went wrong.
52 changes: 15 additions & 37 deletions
52
app/www/content/Module/Slideshow/views/indexAction.html.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,34 @@ | ||
<?php | ||
$slideshowId = 'slideshow_' . $module->id; | ||
$slideshowId = 'module_slideshow_' . $module->id; | ||
$assetsUrl = $kernel->config('url.root') . $kernel->config('cms.dir.modules') . 'Module/' . $module->name . '/assets/'; | ||
?> | ||
|
||
<div id="<?php echo $slideshowId; ?>" class="slideshow_wrapper"> | ||
<div class="slideshow_container"> | ||
<?php foreach($items as $item): ?> | ||
<div class="slideshow_item"> | ||
<div id="<?php echo $slideshowId; ?>" class="module_slideshow_wrapper"> | ||
<?php foreach($items as $item): ?> | ||
<div class="module_slideshow_item"> | ||
<?php if($item->link): ?><a href="<?php echo $item->link; ?>"><?php endif; ?><img src="<?php echo $item->url; ?>" alt="<?php echo $item->caption; ?>" /><?php if($item->link): ?></a><?php endif; ?> | ||
<?php if($item->caption): ?> | ||
<div class="slideshow_item_caption"><p><?php echo $item->caption; ?></p></div> | ||
<div class="module_slideshow_item_caption"><p><?php echo $item->caption; ?></p></div> | ||
<?php endif; ?> | ||
</div> | ||
<?php endforeach; ?> | ||
</div> | ||
<?php endforeach; ?> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
$('#<?php echo $slideshowId; ?>').slides({ | ||
container: 'slideshow_container', | ||
preload: true, | ||
preloadImage: '<?php echo $assetsUrl; ?>images/loading.gif', | ||
play: <?php echo (int) $module->setting('slide_delay', 5000); ?>, | ||
pause: <?php echo (int) $module->setting('slide_delay', 5000); ?>, | ||
slideSpeed: <?php echo (int) $module->setting('slide_speed', 5000); ?>, | ||
hoverPause: true, | ||
crossfade: true, | ||
animationStart: function(current) { | ||
$('.slideshow_item_caption').stop().animate({ | ||
bottom: -35 | ||
},100); | ||
}, | ||
animationComplete: function(current) { | ||
$('.slideshow_item_caption').stop().animate({ | ||
bottom:0 | ||
},200); | ||
}, | ||
slidesLoaded: function() { | ||
$('.slideshow_item_caption').stop().animate({ | ||
bottom:0 | ||
},200); | ||
// @link http://jquery.malsup.com/cycle/lite/ | ||
$('#<?php echo $slideshowId; ?>').cycle({ | ||
delay: <?php echo (int) $module->setting('slide_delay', 5000); ?>, | ||
speed: <?php echo (int) $module->setting('slide_speed', 2000); ?>, | ||
pause: true, | ||
height: <?php echo (int) $module->setting('height', 300); ?>, | ||
before: function() { | ||
console.log(this); | ||
} | ||
}); | ||
</script> | ||
|
||
<?php | ||
// Add javsacript for slideshow to page | ||
$asset = $view->helper('Asset'); | ||
$view->head()->script($assetsUrl . '/scripts/jquery.slides.min.js'); | ||
$view->head()->append(' | ||
<style type="text/css"> | ||
#' . $slideshowId . ' .slides_container { position: relative; width: ' . (int) $module->setting('width', 400) . 'px; display: none; } | ||
#' . $slideshowId . ' .slideshow_item { width: ' . (int) $module->setting('width', 400) . 'px; height: ' . (int) $module->setting('height', 300) . 'px; display: block; } | ||
</style>'); | ||
$view->head()->script($assetsUrl . '/scripts/jquery.cycle.lite.min.js'); | ||
?> |