Skip to content

Instantly share code, notes, and snippets.

/Php

Created February 21, 2014 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/9133331 to your computer and use it in GitHub Desktop.
Save anonymous/9133331 to your computer and use it in GitHub Desktop.
anything slider
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID,
'orderby' => 'menu_order ID',
);
$attachments = get_posts($args);
if ($attachments) {?>
<div id="slider" class="slider">
<?php
$i = 1;
foreach ($attachments as $attachment) {
//echo apply_filters('the_title', $attachment->post_title);
$image = wp_get_attachment_image_src( $attachment->ID, 'full' ); ?>
<div>
<img class="check" src="<?php echo get_template_directory_uri() ?>/js/timthumb.php?src=<?php echo $image[0] ?>&amp;w=610" />
</div>
<?php
$i++;
} ?>
<script type="text/javascript">
jQuery(document).ready(function($){
$('#slider').anythingSlider({
hashTags : false,
expand : true,
autoPlay : true,
resizeContents : false,
pauseOnHover : true,
buildArrows : false,
buildNavigation : false,
delay : <?php echo $data['pausetime'] ?>,
resumeDelay : 0,
animationTime : <?php echo $data['anispeed'] ?>,
delayBeforeAnimate:0,
easing : 'easeInOutQuint',
onSlideBegin : function(e, slider) {
$('.nextbutton').fadeOut();
$('.prevbutton').fadeOut();
},
onSlideComplete : function(slider) {
$('.nextbutton').fadeIn();
$('.prevbutton').fadeIn();
}
})
$('.blogsingleimage').hover(function() {
$(".slideforward").stop(true, true).fadeIn();
$(".slidebackward").stop(true, true).fadeIn();
}, function() {
$(".slideforward").fadeOut();
$(".slidebackward").fadeOut();
});
$(".pauseButton").toggle(function(){
$(this).attr("class", "playButton");
$('#slider').data('AnythingSlider').startStop(false); // stops the slideshow
},function(){
$(this).attr("class", "pauseButton");
$('#slider').data('AnythingSlider').startStop(true); // start the slideshow
});
$(".slideforward").click(function(){
$('#slider').data('AnythingSlider').goForward();
});
$(".slidebackward").click(function(){
$('#slider').data('AnythingSlider').goBack();
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment