Hello readers we are back with another interesting article.This is based on the topic  jQuery. HOpe alll are doing well and safe. Explore all the contents in our blog and support us.

In this article we are gonna code a pop up banner or a box. This pop up boxes are mainly used as a means of link promotion in the blog.  Here I have concentrated on the Youtube link promotion, The main intention is using HTML to create a pop up banner.

In this article I have mentioned in detail the steps of creating pop up banner..

What are the Contents included in the pop up banner?
  • In the Header your blog name.
  • Include the icon in which platform you need to promote the article. Youtube in this case.
  • Link which you have to promote.
  • A visit button, In the case of Youtube I have included the "play now" button.
  • The next thing is the "cancel" or the "close" button.

You might like these:


Video for clear understanding: 

Here I have explained in detail about the code, For better understanding the video is provided.


HTML:



The HTML code for this is quite simple. First a  button is created on clicking it teh pop up banner will appear. In the next part a "banner"  class is created in which the contents are present which would appear in the banner. At the top name of the blog is created using <p> tag and made bold. Next the youtube icon is created using the "i class='fa fa-youtube-play'".

Within the "banner" class a "linking" class is created which contains the link you are willing to promote. And at the end two buttons namely "play now" and "cancel" are created.

CSS: 



The body and html area is customized by setting setting height and width to 100% and placing the items in center and the background color is made mixing 2 colors using "-webkit-linear-gradient".

For the "fa" class in which the youtube icon comes the color is set to red, and padding to 10px and the
"left" attribute is adjusted according to requirement.

 For the "banner" class "position" is set to "absolute" and the bottom attribute is set to 0 as the banner pops up from below. Background color and box shadow are specified according to requirement. The height is set to '0' because the Banner will not be visible at the beginning it will only appear only when the button is pressed.

For The "linking" class a border of 1px is given and other attributes according to the requirements.

For the "play now" button orange color is given and for the "cancel" black color is given. The cancel button is made to float left.

jQuery: 



jQuery is like the main thing for function of the pop up operation. At first the banner is hidden bu using "hide()" function.First on clicking the "click" button the following the banner is made visible by "show()" function and in the animate function the height is made to change to "480px" and the "bottom" attribute is set to "20%" so it can be shown in the middle and slides(pops up) above.

On clicking the play button the link for the video will be appeared.

On clicking the "cancel" button exactly the reverse of "click" button will occur. The height is made to change to '0' and bottom to 0% and the banner is hidden using "hide()" function. It will appear as if the banner is popping down.

It's Done..

Thanks for reading.





 


 

Post a Comment

Previous Post Next Post