ページ 11

jQueryプラグインのスライドショーを使いたい

Posted: 2011年11月28日(月) 17:06
by 8nda3
いつもこちらのフォーラムにお世話になっております。

いつも初歩的で恥ずかしい質問ばかりですが・・・ :oops:
以下のリンク先のスライドショーをトップページに使用したいのですが、うまくいきません。
どのように記述すればいいのでしょうか。
http://www.htmldrive.net/items/show/324 ... lugin.html

ダウンロードしたソースをftpでアップロードすると問題ないのでModxではテンプレートに記述しました。
以下内容です。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="[(site_url)]" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>[*pagetitle*]|[(site_name)]</title>
<meta name="description" content="[*description*]" />
<link href="[~18~]" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jq ... "></script>
<script src="js/desSlideshow.js"></script>
<script language="javascript" type="text/javascript">
$(function() {
$("#desSlideshow1").desSlideshow({
autoplay: 'enable',//option:enable,disable
slideshow_width: '800',//slideshow window width
slideshow_height: '249',//slideshow window height
thumbnail_width: '200',//thumbnail width
time_Interval: '4000',//Milliseconds
directory: 'images/'// flash-on.gif and flashtext-bg.jpg directory
});
$("#desSlideshow2").desSlideshow({
autoplay: 'disable',//option:enable,disable
slideshow_width: '600',//slideshow window width
slideshow_height: '249',//slideshow window height
thumbnail_width: '120',//thumbnail width
time_Interval: '4000',//Milliseconds
directory: 'images/'// flash-on.gif and flashtext-bg.jpg directory
});
});
</script>
</head>

<body>

<div id="desSlideshow2" class="desSlideshow">
<div class="switchBigPic">
<div>
<a title="" href="#"><img class="pic" src="006.jpg" /></a>
<p><strong>Description Title1</strong><br/>
Description Content1
</p>
</div>
<div><a title="" href="#"><img class="pic" src="004.jpg" /></a>
</div>
<div><a title="" href="#"><img class="pic" src="001.jpg" /></a>
<p><strong>Description Title3</strong><br/>
Description Content3
</p>
</div>
<div><a title="" href="#"><img class="pic" src="003.jpg" /></a>
<p><strong>Description Title4</strong><br/>
Description Content4
</p>
</div>
</div>
<ul class="nav">
<li><a href="#">Slideshow1</a></li>
<li><a href="#">Slideshow2</a></li>
<li><a href="#">Slideshow3</a></li>
<li><a href="#">Slideshow4</a></li>
</ul>
</div>

<div>[*content*]</div>


</body>
</html>

この記述ですと、添付画像のようになってしまいます。
なにが原因なのでしょうか?

[modx]
 バージョン : 1.0.5J-r7

Re: jQueryプラグインのスライドショーを使いたい

Posted: 2011年11月30日(水) 15:18
by min-o
貼り付けられたソースみると問題なさそうですが。
<script src="js/desSlideshow.js"></script>
はこの場所にjsファイルがアップロードされてるんですよね。

解説ページにはでてませんが
id="desSlideshow"に対応するcssファイルはいらないのかな? [~18~]に書いてあるのでしょうか?

ページかテンプレートでmootools使ってたりしませんか? ←デフォルトテンプレートに入っているWayfinderメニューで使われてます。
mootoolsとjQueryは高確率でぶつかります。
対処法はこちらがわかりやすいです

jQueryとmootoolsを同時に使う方法
http://h2ham.seesaa.net/article/106053238.html

他にもページ内のスニペットなどでjsファイルを読み込む仕様になっていたりすると、読み込む順番によって動かなかったりします。
プレビューしたページのソースで確認することをおすすめします。

他には
<script src="http://ajax.googleapis.com/ajax/libs/jq ... "></script>
のjqueryのバージョンを変えてみると意外とうまくいくこともあるので、試してみるといいかも。

Re: jQueryプラグインのスライドショーを使いたい  【解決済み】

Posted: 2011年12月05日(月) 11:27
by 8nda3
min-oさま

丁寧なご返信ありがとうございます!

アドバイスどおりチェックをしなおすと、
<script src="js/desSlideshow.js"></script>
のパスの記述ミスでした。

javascriptにも慣れていないもので、知識不足の
原因があるかと思い質問をさせていただいたら、
単純ミスですみません;;

ほんとうにありがとうございました :D