回答編集履歴
1
調整
test
CHANGED
@@ -1,3 +1,43 @@
|
|
1
1
|
ページAから遷移時にgetで値をわたし、Bではlocation.seachを参照して
|
2
2
|
|
3
3
|
ロード時の処理を書くと良いでしょう
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
# sample
|
8
|
+
|
9
|
+
たとえばこう
|
10
|
+
|
11
|
+
```javascript
|
12
|
+
|
13
|
+
<script>
|
14
|
+
|
15
|
+
$(function(){
|
16
|
+
|
17
|
+
$('button').on('click',function(){
|
18
|
+
|
19
|
+
console.log($(this).data('filter'));
|
20
|
+
|
21
|
+
});
|
22
|
+
|
23
|
+
var btn=location.search.match(/[?&]btn=(.+?)(?=&|$)/);
|
24
|
+
|
25
|
+
if(btn) $('#'+btn[1]).trigger('click');
|
26
|
+
|
27
|
+
});
|
28
|
+
|
29
|
+
</script>
|
30
|
+
|
31
|
+
<a href="?btn=3">3</a>
|
32
|
+
|
33
|
+
<hr>
|
34
|
+
|
35
|
+
<button class="filter" data-filter="all1" id="1">1</button>
|
36
|
+
|
37
|
+
<button class="filter" data-filter="all2" id="2">2</button>
|
38
|
+
|
39
|
+
<button class="filter" data-filter="all3" id="3">3</button>
|
40
|
+
|
41
|
+
<button class="filter" data-filter="all4" id="4">4</button>
|
42
|
+
|
43
|
+
```
|