-
MODX Staff
- 730 Posts
I have edited the original post because, as WeBe pointed out, and fruitwerks found out, the snippet should return an empty string ’’ instead of true. Silly me.
Sorry for the frustration - this has taught me to test out code that I post here instead of just doing the stream of consciousness thing.
You mean just a drop-down menu that reloads the page with the query string? Sure. You could do something like:
In the head:
<script type="text/javascript">
function jumpMenu(list) {
location.href=list.options[list.selectedIndex].value
}
</script>
Where you want the links:
<select onchange="jumpMenu(this)">
<option>Font Size:</option>
<option value="index.php?fontsize=11">11px</option>
<option value="index.php?fontsize=13">13px</option>
<option value="index.php?fontsize=15">15px</option>
</select>
You could also use JavaScript to apply the CSS rule without reloading the page, but that would be a major rewrite.
May I am not understanding your solution, or I didn’t make myself clear...
I would like to place these links into the existing main nav menu of the site.
Thanks!
Oh... well then you could just create a weblink for each URL (using WayFinder, I presume). I kinda like these things in a drop-down menu, myself.
A drop-down would be cool, but how accessible is it? Honestly I could not get it to work in wayfinder so I will check out your idea when I have more time.
Thanks!
This method requires JavaScript, but people who turn off JavaScript shouldn’t expect anything dynamic in my opinion. Serves em right. I think this should work on pretty much any browser, but if you have trouble you can find many simpler examples on the web (oh and I guess you should add <form> tags around it for proper validation).