HTMLコードが直接書かれているかのようにjQueryでdiv要素を追加することが行われていません。それはHTML
<div class="swiper-container">
<div class="swiper-wrapper"></div>
<div class="swiper-pagination"></div>
</div>
jqueryの:
<script type="text/javascript" >
var queryString = (window.location.href).substr((window.location.href).indexOf('?') + 1);
var value = (queryString.split('='))[1];
$(document).ready(function() {
$.getJSON("http://localhost/phoneGap/AnyScan/www/image.php?typeID="+value,function(result){
$.each(result, function(i, field){
$(".swiper-wrapper").append("<div class='swiper-slide'><a href='http://localhost/anyscan/images/"+field.content+"'><img src='http://localhost/anyscan/images/"+field.content+"' width='100%' height='100%'></a></div>");
});
});
});
</script>
私は、すべての画像を画像間でスワイプするための外部ファイルを使用しています
<div class="swiper-container">
<div class="swiper-wrapper">
<div class=swiper-slide>image 1</div>
<div class=swiper-slide>image 2</div>
<div class=swiper-slide>image 3</div>
<div class=swiper-slide>image 4</div>
</div>
</div>
問題は次のようになります。
<div class="swiper-slide"><a href='http://localhost/anyscan/images/icon-30182012-08-12-133.jpg'><img src='http://localhost/anyscan/images/icon-30182012-08-12-133.jpg' width='100%' height='100%'></a></div>
<div class="swiper-slide"><a href='http://localhost/anyscan/images/icon-59071hyt%20002.jpg'><img src='http://localhost/anyscan/images/icon-59071hyt%20002.jpg' width='100%' height='100%'></a></div>
<div class="swiper-slide"><a href='http://localhost/anyscan/images/icon-11955hyt%20003.jpg'><img src='http://localhost/anyscan/images/icon-11955hyt%20003.jpg' width='100%' height='100%'></a></div>
それは完璧に動作します:私は、ブラウザを最小化し、(私はなぜ知らない)それを最大化しない限り、画像をスワイプしませんが、私はこのようなHTML内の画像のリンクを置けばjqueryのコード、どんな助け?
にコンテンツを追加した後
onResize()
またはupdate()
メソッドを呼び出すために試すことができます –はい私はwriperマスタープラグイン –
を使用していますを行う方法[swiper](http://idangero.us/swiper/)プラグインを初期化すると、あなたのページに 'var swiper = new Swiper( 'swiper-container');'のようなものがありますか? –