这里的逻辑很简单,我不知道如何将值与window.location.hash
. 类似的东西.split('=')[0]
,但删除它之前的所有内容而不是之后的所有内容。
一些潜在的哈希:/#work
/#work=video1
我想说:
var hash = window.location.hash,
val = hash.split('=')[0];
if (val != ''){
do some stuff because there IS a value
i.e. once split, the value is something
} else {
do some other stuff because there IS a value
i.e. once split, the value is nothing
}