function hashChecker(){
var hash = (window.location.hash).replace('#', '');
if (hash.length == 0) {
//no hash do something
} else {
//else do something with hash
if (window.location.hash == "#hashname") {
// do something
}
}
}
Tag: jQuery
Countdown Timer
If you do not see any timer at below, change the time variable.
jQuery: Create basic plugin
jQuery: IP based Geolocation
jQuery: Using window url parameter
Let’s say we have passed a parameter to URL: www.mysite.com/?page=test
To collect the data form parameter we can use this function:
function getUrlParameter(name) { name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); var regex = new RegExp('[\\?&]' + name + '=([^&#]*)'); var results = regex.exec(location.search); return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' ')); };
use of this code:
getUrlParameter('page');
or
if (getUrlParameter('page') == 'test'){ // do something }
jQuery item / image slider
Select random element using jQuery
Everytime you refresh, it will select random element & show it’s class
jQuery Tabs using CSS
Positioning DIV in middle of another DIV
Removing CSS file link dynamically
Here style.css is already exist on the top of the file.
I am using just one line jQuery code to remove the CSS.
$('link[rel=stylesheet][href*="/wcsstore/abc/mobile/css/style.css"]').remove();