ここに私の状況です: 私のウェブサイトでWD Gridfolioを使用しています。コレクションページでこの方法でクリックすると、新しいURL。URLハッシュ=記事IDの場合、このIDのCSSを変更してください
--- --- UPDATE
私はそれを介して、仕事ガット:
if(window.location.hash) {
var hash = window.location.hash.substring(1);
$("#"+hash).find(".wmg-thumbnail2").trigger("click")
}
--END UPDATE ---
素晴らしい作品。
しかし、私は「オープン」の項目へのリンクを与えることはできません。このページ
http://domain.com/mycollection
すべての項目の表示されている、私は希望 - 1つの項目のユーザクリック、URLはできるようにするには、この
http://domain.com/mycollection/item1またはhttp://domain.com/mycollection#item1
になることをするとき別のユーザーにこのURLを与えるために、この方法は、人々は、このリンクに行く、彼らは「オープン」の項目を持つページに到着しなければなりません。私はハッシュ=記事のIDは、それが開いているために、この記事のIDにクラスとCSSを追加した場合のようなjavascriptの仕事をしようとしてきたこれから
。私のような何かしようとしました:(はい間違いがたくさんある
if (window.location.hash){
var hash = window.location.hash.substring(1);
if (hash == "#article-{id}"){
openFeedbackForm();
$onclick('.wmg-item2'+ "#article-{id}"){
add.class('.open')
};
(.'wmg-details');
change.css('overflow','visible')
}
}
:パスが通りsomethign同様のを取るshoudl ...成功事例のがなければ
を
$('.wmg-container2').find('.wmg-item2').each(function(){
if ($(this).parent().attr('#article-{id}') == hash) {
$add.class('open');
}
});
をそれはちょうどパスを理解させるためにね)
これはレアがいかに任意のアイデア - この最後のコードでライズ?以下は
私のページの構造である:
<div class="wmg-container2 my-grid2">
{.repeated section items}
<div class="wmg-item2" data-item-id="{id}" id="article-{id}">
<div class="wmg-thumbnail2">
<div class="wmg-thumbnail-content2">
<!-- exemplo de conteudo para thumbnail -->
{.main-image?} <img data-image-dimensions="{originalSize}"
src="{fullUrl}?format=2500w"> {.end}
<!-- fim do exemplo -->
</div>
<div class="all-overlay">
<div class="meta-overlay">
{.section categories}
<div>
<em>{.equal? collection.typeName
"products"}Found{.or}{.end}</em> {.repeated section
@}<a href=
"{collection.fullUrl}?category={@|url-encode}" rel=
"tag" style=
"float:none;color:white;width:100%;left:20px;position:absolute;top:7px;text-transform:uppercase">{@}</a>{.alternates
with}, {.end}
</div>{.end} {.if categories && tags} <em></em> {.end}
</div>
<div class="title-overlay">
{title}
</div>
</div>
</div>
<div class="wmg-details2">
<div class="wmg-details-content2">
<!-- exemplo de coteúdo para detail -->
<div class="container2 exemplo2">
{body}
</div><!-- fim do exemplo -->
</div><span class="wmg-close2"></span>
</div>
</div>{.end} {.end}
</div>
は本当にその上のすべてのあなたの時間/ヘルプ/アドバイスに感謝!
にURLを変更しますあなたは既にhttp://stackoverflow.com/questions/38976501/url-hastag-to-have-item-open-であなたの質問をポートフォリオグリッドから。古い質問を更新するのではなく、重複した投稿を提出しないでください。 (https://developer.mozilla.org/en-US/docs/Web/CSS/:target)擬似クラス: –
これらのリンクは、[target' ']を見てみましょう –
動作していません。 – robertklep