urlに「カタログ」という単語が含まれているかどうか確認できます。jquery urlに単語が含まれているかどうかを確認する方法は?
これは私がしようとしています何です...
$(document).ready(function() {
if (window.location.href.indexOf("catalogue"))
{
$("#trail").toggle();
}
});
サイトのURLは可能性があり
..
http://site.co.uk/catalogue/
それとも
http://site.co.uk/catalogue/2/domestic-rainwater.html
など
しかし、それは動作しません。私が間違っているところを誰かが指摘してくれる?
if(window.location.href.indexOf( "catalog")> -1) – rt2800
http://stackoverflow.com/questions/897903 /もし存在すればテストする条件をウィンドウ内の位置-href – Richard
['.indexOf()'ドキュメント](https://developer.mozilla.org/ja/JavaScript)を試しましたか?/Reference/Global_Objects/String/indexOf)? – nnnnnn