Sets up region selection
- Source:
Properties:
Name | Type | Description |
---|---|---|
selectors |
object | DOM query selectors |
states |
object | CSS classes |
Example
<section data-region-picker>{{region menu here}}</section>
Methods
(inner) changeRegion()
- Source:
Update the user's region cookie
(inner) changeRegionContent(region, $target)
- Source:
Make an ajax request to get content for selected region
Parameters:
Name | Type | Description |
---|---|---|
region |
string | selected region |
$target |
element | target element where new content should be added |
(inner) handleClick($changeTarget, pickerId, event)
- Source:
Verify that the user has clicked on a link within the region selection module Then pass along the region name that was clicked on
Parameters:
Name | Type | Description |
---|---|---|
$changeTarget |
element | update content in $changeTarget based on new region |
pickerId |
string | picker id |
event |
event |
(inner) init()
- Source:
Search for any region selection modules and bind click events
(inner) parseRegion()
- Source:
Slugify the region name
(inner) postRegion(region, redirectUrl)
- Source:
Send region as a POST request for vary cache
Parameters:
Name | Type | Description |
---|---|---|
region |
string | region to remember |
redirectUrl |
string | optional URL to redirect to when post completed |
(inner) saveRegion()
- Source:
Save region cookie - save two cookies in staggered expiry to keep region cookie alive to prevent infinite geo detection loop.
(inner) trackRegionChange()
- Source:
Track region change in Google and Adobe analytics