これで動くかな。ソースを見ると nextSlide( index )
prevSlide( index )
が用意して有るので、それを使うのがいいでしょう。
PHP
1<script>var arr = [];</script>
2<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
3
4 <!-- >(中略)< -->
5
6 <script>arr.push( '<?php echo $bgcolor?>' );</script>
7<?php endwhile; endif; ?>
8<script>
9;( function( $ ) {
10 var func = function( index ) {
11 $( '#swipebox-overlay' ).css( 'background-color', arr[ index ] );
12 };
13 $( '.swipebox' ).swipebox( {
14 nextSlide: func
15 , prevSlide: func // ,が抜けていました、すいません。
16 } );
17
18} )( jQuery );
19</script>
追記:
ひとまず下記で動くことを確認しました。
HTML
1<link rel="stylesheet" href="src/css/swipebox.css">
2<script>var arr = [];</script>
3<ul class="columns">
4 <li class="a-post">
5 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/300">001</a>
6 <script>arr.push( '#ffa' );</script><!-- li要素の外に置かない -->
7 </li>
8 <li class="a-post">
9 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/400">002</a>
10 <script>arr.push( '#faf' );</script><!-- li要素の外に置かない -->
11 </li>
12 <li class="a-post">
13 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/500">003</a>
14 <script>arr.push( '#aff' );</script><!-- li要素の外に置かない -->
15 </li>
16 <li class="a-post">
17 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/600">004</a>
18 <script>arr.push( '#00a' );</script><!-- li要素の外に置かない -->
19 </li>
20 <li class="a-post">
21 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/700">005</a>
22 <script>arr.push( '#0a0' );</script><!-- li要素の外に置かない -->
23 </li>
24 <li class="a-post">
25 <img src="http://placehold.it/50"><a rel="gallery" class="swipebox" href="http://placehold.it/800">006</a>
26 <script>arr.push( '#a00' );</script><!-- li要素の外に置かない -->
27 </li>
28</ul>
29<script src="lib/jquery-2.1.0.min.js"></script>
30<script src="src/js/jquery.swipebox.js"></script>
31<script>
32;( function( $ ) {
33 var func = function( index ) {
34 $( '#swipebox-overlay' ).css( 'background-color', arr[ index ] );
35 };
36 $( '.swipebox' ).swipebox( {
37 afterOpen: func
38 , nextSlide: func
39 , prevSlide: func
40 } );
41
42} )( jQuery );
43</script>
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/05/14 06:54 編集
2016/05/14 08:40
2016/05/14 10:14