1

構築中の JQTouch サイトの特定の内部パネルに到達する外部サイトからのリンクを作成しようとしています。ただし、リンクで使用するアンカー タグに関係なく、ブラウザは常に JQT サイトのホーム パネルを開きます。

たとえば、公式の JQTouch デモでユーザー インターフェイス パネルにリンクしようとすると、http: //www.jqtouch.com/preview/demos/main/#ui を使用しますが、ホーム パネルはブラウザに表示され、サブパネルには表示されません。私はお願いしました。

どんな提案でも大歓迎です。私はリンクされたサイトとリンクしているサイトの両方を管理しているので、コードを微調整する必要があります。

ありがとう

4

1 に答える 1

2

ソース コード ( http://code.google.com/p/jqtouch/source/browse/trunk/jqtouch/jqtouch.js ) によると、jqTouch はページの最初にcurrentクラスが追加された部分を読み込みます。

jqtouch.js の 179 行目:

// Make sure exactly one child of body has "current" class
if ($('#jqt > .current').length == 0) {
  currentPage = $('#jqt > *:first');
} else {
  currentPage = $('#jqt > .current:first');
  $('#jqt > .current').removeClass('current');
}

// Go to the top of the "current" page
$(currentPage).addClass('current');
location.hash = '#' + $(currentPage).attr('id');
addPageToHistory(currentPage);

したがって、最善の方法は、jqtouch ソースを実行する前にwindow.location.hash変数を確認し、そこにあるハッシュをクラスに設定することです。current

このヒューリスティックに沿った何か:

<script include jquery>
<script>
var cur = document.location.hash;
if (cur) {
  $('.current').removeClass('current');
  $(cur).addClass('current');
}
</script>
<script include jqtouch>
于 2010-04-10T19:07:36.103 に答える