Pages

Sunday, December 9, 2018

Scroll To Top Jquery Function and html

<script>
$(window).scroll(function() {
    if ($(window).scrollTop() > 100) {
        // > 100px from top - show div
      $('.scrollBtn').show();

    }
    else {
        // <= 100px from top - hide div
      $('.scrollBtn').hide();
    }
});
$("#button").click(function() {
   $('html, body').animate({
        scrollTop: $("header").offset().top
    }, 2000);
});$
</script>
<div class="scrollBtn" style="display: none;"> <
a href="javascript:;" id="scrollButton"><img src="images/arrowUp.png"></a>
</div>

<style>
.scrollBtn {
position: fixed; 
right: 20px; 
bottom: 20px; 
width: 40px; 
height: 40px; 
z-index: 10;}
.scrollBtn img {width: 100%; }
</style>

Wednesday, December 5, 2018

Random Color return in PHP function


function random_background_image(){
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
return $color = '#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)]."45";
}

// function call
echo random_background_image();

Sunday, December 2, 2018

Redirect Domain and its all urls to you New domain using .htaccess


Using .htacess you can redirect the domain or page or link into your own or even can change the url of your domain in the .htaccess file.

Here is simple example to redirect the old domain to new domain in the .htaccess file

Permanant Redirect (301)

Syntax:
-------------------------------------------------------------------------------------
Redirect 301 / https://yourdomain.com/
Redirect 301 https://yourolddomain.com/ https://yournewdomain.com/