I need to get an overlay to slide down based on what the URL has at the end of it.
If (URL has ‘faq’ at the end)
{
overlay comes down
}
How can you do that in jQuery/JavaScript?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your URL looks something like this
http://yourdomain.com/faq, you could do something like this:This would make it possible to check for other endings and act on them as well.
Update:
To get it working, even if the URL has a trailing slash, you could create a function like this:
You could then call the function like
getLastPart(window.location.href)to get the last part of the URL for the current page.Here is a working example as well: http://jsfiddle.net/WuXHG/
Disclaimer: If your URLs use hashes at the end, or a querystring, you would have to strip the from the URL first, for this script to work properly