antknight Posted November 23, 2012 Posted November 23, 2012 http://tobia.github.com/CrossSlide/ I would like to use the CrossSlide jQuery plugin with PW, in particular the Ken Burns effect, but how would I use PW to output the source images into the CrossSlide code? I am pretty with sure other slideshows, you can just list the source images in the HTML, which would be simple, but I like to make things difficult! Thanks
diogo Posted November 23, 2012 Posted November 23, 2012 See here how you can create the variables with pw data to use in javascript http://processwire.com/talk/topic/803-tinymce-insert-image-modal-window/#entry20546 1
ryan Posted November 24, 2012 Posted November 24, 2012 Taking the first example from the CrossSlide site, you could do it like this: <script type='text/javascript'> $(document).ready(function() { $('#placeholder').crossSlide({ sleep: 2, fade: 1 }, [ <?php $o = ''; foreach($page->images as $img) $o .= "{ src: '$img->url' },"; echo rtrim($o, ","); ?> ]); }); </script> I'm stuffing it into the variable $o before echoing it just so that I can trim off the trailing comma, which prevents a JS error in some browsers. 1
antknight Posted November 24, 2012 Author Posted November 24, 2012 Thanks Ryan, that trailing comma was exactly what I was wondering about how to deal with!
neildaemond Posted November 25, 2012 Posted November 25, 2012 cool, I've never considered this ken burns effect before... looks pretty nice.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now