There are several ways to redirect a user from one URL to another. There might be several reasons to do this. I am describing different ways to redirect a URL or page quickly and seamlessly including redirect URL using JavaScript, use a meta tag, redirect using an htaccess file, redirection using PHP and finally redirect URL in WordPress.
Category » jQuery
Toggle class using jQuery
Sometimes we faced the problem of toggling the class in html because of only by changing the classes can do a different action in html.
Toggle class means exchange the class names. We can toggle class using jQuery as follows:
$(document).ready(function(){ if($('#id').hasClass('active')) $('#id').removeClass('active').addClass('deactive'); else $('#id').removeClass('deactive').addClass('active'); })
Arrow on scrolling the page using jquery
Sometimes we faced the problem on scrolling the content on the page and go to the bottom of the page and feel we need to go on top of the page.
For that we need to scroll the page again which is irritating. If there would be any option to click on which we can jump to top of the page easily seems good.
Opening a html page within fancybox
Opening inline HTML in a fancybox popup is easily achievable but once I faced the problem of opening a html page within the fancybox popup.
After googling, I found the solution that ‘type’ property of fancybox we need to include on calling of it.
How to open fancybox on page load?
Opening fancybox on page load is very simple. just call below given code in document ready eg.
$(document).ready(function () { $.fancybox({ 'width': '80%', 'height': '80%', 'autoScale': true, 'transitionIn': 'fade', 'transitionOut': 'fade', 'type': 'iframe', 'href': 'http://www.example.com' }); });