<script type="text/javascript"> $(window).load(function(){ var cont = jQuery('#contents'); var contW = jQuery('.section-horizontal img').outerWidth(true) * jQuery('div a img',cont).length + 640 ; /* 640pxはtext分を足した数 */ cont.css('width', contW); var speed = 500; jQuery('html').mousewheel(function(event, mov) { //ie firefox jQuery(this).scrollLeft(jQuery(this).scrollLeft() - mov * speed); //webkit jQuery('body').scrollLeft(jQuery('body').scrollLeft() - mov * speed); return false; //縦スクロール不可 }); }); </script>
上記のコードですと、先頭の.section-horizontal imgの横幅を元にした.section-horizontal imgのn個の合計が
#contentsのwidth横幅になってしまいます。
実現したいことは、.section-horizontal imgの横幅は画像サイズによって異なるため、各横幅サイズの合計を取得したいのですが、解決方法を教えていただけますしょうか。
<div id="contents"> <?php if( get_field('img01') ): ?> <div id="s01" class="section-horizontal"> <a href="#s02"><img src="<?php the_field('img01'); ?>"></a> </div> <?php endif; ?> <?php if( get_field('img02') ): ?> <div id="s02" class="section-horizontal"> <a href="#s03"><img src="<?php the_field('img02'); ?>"></a> </div> <?php endif; ?> . .
アドバンスカスタムフィールドで画像をページ投稿表示しております。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/01/11 01:51
退会済みユーザー
2016/01/11 02:07
退会済みユーザー
2016/12/17 01:48 編集
退会済みユーザー
2016/01/11 02:30
退会済みユーザー
2016/01/11 02:49