{"id":1655,"date":"2008-09-07T09:35:36","date_gmt":"2008-09-07T13:35:36","guid":{"rendered":"http:\/\/teamtutorials.com\/?p=1655"},"modified":"2008-10-26T14:44:13","modified_gmt":"2008-10-26T18:44:13","slug":"jquery-pop-over-effects","status":"publish","type":"post","link":"https:\/\/teamtutorials.com\/web-development-tutorials\/jquery-pop-over-effects","title":{"rendered":"jQuery Pop Over Effects"},"content":{"rendered":"
This tutorial we will create a pop over box using the jQuery Javascript Framework. I will demonstrate a few of the animation option in jQuery and discuss why you should or shouldn\u2019t use them. <\/p>\n
Disclaimer: Why jQuery? Basically I used jQuery here because it is fast and simple. You could accomplish all of the effects by writing you own Javasciprt, but why do that when the makers of jQuery have done it all for you?<\/p>\n First you will need to download the latest version of jQuery<\/a>. At the time of the post the current version is called jquery-1.2.6.min.js. Save jQuery to the same folder you will be saving your html files to, I called mine jQuery.<\/p>\n Next we need to layout the page. I am not going to explain all of the code in this tutorial. If you don\u2019t understand it please see our XHTML and CSS tutorials. The part that you will want to pay attention to is the pop up. Download the box.png file here (box.png):<\/p>\n <\/a><\/p>\n Here is the source code for the page layout:<\/p>\n So as you see we have the page with our pop box open. Make sure that everything looks right; the box is showing and center, etc. Now we don\u2019t want this popup to show by default so we will hide it. In the CSS we will set the display value to none on the #box. Add the line \u2018display: none;\u2019 to the existing css code.<\/p>\n
\nI will be using a transparent .png for this tutorial. Not all browsers handle the transparency right. Also some browsers, like Internet Explorer, will display the transparency fine if it is a normal image on a page. When you try to animate that image you will get the \u201chalo\u201d effect. You will see what I mean later. If you are using a browser that supports transparent .png file, you will need to find the .png fix for it. Here are some png fixes for IE 5-7<\/a> , you can link directly to the files hosted at Google if you would like to.<\/p>\n\r\n<html>\r\n<head>\r\n<title>jQuery Pop In<\/title>\r\n\r\n<style type="text\/css">\r\n<!--\r\n#box\r\n{\r\nposition: absolute;\r\ntop:25%;\r\nleft:25%;\r\nwidth:50%;\r\ntext-align: center;\r\n}\r\n\r\n#form{\r\nbackground: url('box.png') no-repeat;\r\nwidth: 450px;\r\nheight: 425px;\r\nmargin: 0 auto;\r\n}\r\n-->\r\n<\/style>\r\n\r\n\r\n<\/head>\r\n\r\n\r\n<body>\r\n<a href="#" id="in">Fade Box<\/a> <!-- Button to Fade the div in -->\r\n<a href="#" id="show">Show Box<\/a> <!-- Button to Simply show the box with no effect -->\r\n<a href="#" id="slide">Slide Box<\/a> <!-- Button to slide the box in -->\r\n\r\n\r\n<div id="box"> <!-- This container centers the box in your browser windo -->\r\n\r\n<div id="form"><\/div> <!-- This is the actual box.-->\r\n\r\n<\/div><!-- end #box-->\r\n\r\n<\/div><!-- end #form-->\r\n\r\n\r\n<!-- the rest is the basic page layout-->\r\n<div id="page">\r\n\r\n<h2>This is the page<\/h2>\r\n<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam porta quam eget\r\nturpis placerat aliquam. Praesent eget metus. Aliquam fermentum, massa a pulvinar\r\nsodales, justo velit consectetuer purus, at vehicula magna libero quis sapien.\r\nPraesent molestie. Pellentesque habitant morbi tristique senectus et netus et\r\nmalesuada fames ac turpis egestas. Vivamus id diam non metus euismod sollicitudin.\r\nDuis lobortis leo vel dui. Nulla ultricies tortor at augue. Proin egestas feugiat nibh.\r\nMaecenas a pede sed lorem vestibulum facilisis.>\/p>\r\n\r\n<p>Curabitur venenatis tempus risus. Lorem ipsum dolor sit amet, consectetuer\r\nadipiscing elit. Praesent elit. Donec imperdiet dapibus lorem. Mauris imperdiet lacinia\r\nlacus. Aliquam pellentesque enim ut nisl. Pellentesque tristique, augue egestas porttitor\r\nsuscipit, lacus dui tempus dui, in commodo lacus mauris non tortor. Lorem ipsum dolor sit\r\namet, consectetuer adipiscing elit. Duis vel neque sed nibh pharetra adipiscing. Etiam\r\neuismod rhoncus dui. Sed ut nulla. Quisque mollis.<\/p>\r\n\r\n<p>Praesent libero turpis, ultrices nec, blandit sed, cursus sed, augue. Cum sociis\r\nnatoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec hendrerit\r\npretium elit. Donec eget dui in mauris lobortis viverra. Vestibulum pharetra, libero in\r\nbibendum malesuada, ante ligula lobortis turpis, eu tempor turpis libero at lacus. Curabitur\r\nsemper, ligula non mattis semper, neque dolor fermentum arcu, quis vehicula ipsum mi sed libero.\r\nSuspendisse potenti. Integer ut lacus nec sem hendrerit ornare. Nulla eros. Duis nec mauris.\r\nCras ac turpis vel ante venenatis consequat. Sed rutrum lobortis augue. Aenean mi lectus,\r\nvulputate quis, rutrum in, pharetra id, dolor. Proin posuere pede vitae ipsum. Curabitur euismod\r\nsemper odio. Ut tristique scelerisque leo. Fusce at ante sit amet lorem pharetra viverra. In hac\r\nhabitasse platea dictumst.<\/p>\r\n\r\n<p>Curabitur id nunc. Cras euismod, orci sed eleifend tempus, massa lacus sodales metus, vitae\r\ntristique augue elit a tortor. Vestibulum viverra, nisi id faucibus sodales, nunc dolor condimentum\r\neros, et accumsan velit orci ut dolor. Donec dolor dolor, porttitor nec, porta in, rutrum vel, leo.\r\nSuspendisse erat eros, ultricies in, auctor in, pretium vel, ante. Aliquam erat volutpat.\r\nVestibulum auctor ipsum ut risus. Maecenas nec sapien. Nullam eget ipsum nec sapien ornare dapibus.\r\nPellentesque ligula. Pellentesque habitant morbi tristique senectus et netus et malesuada fames\r\nac turpis egestas. Integer ac pede. Phasellus eleifend malesuada nibh. Ut laoreet, mi a auctor\r\nfermentum, magna lectus placerat ligula, a vestibulum sapien arcu non nunc. Vivamus tristique.\r\nVestibulum sagittis est.<\/p>\r\n\r\n<p>\r\nPhasellus tincidunt neque et dui. Praesent sed enim. Aliquam gravida pulvinar quam. Class aptent\r\ntaciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed vitae ante nec\r\ntellus rutrum pharetra. Praesent sodales tempus magna. Vestibulum fermentum imperdiet leo. Praesent\r\nvel augue. Proin at nisi. Etiam volutpat venenatis ipsum. Morbi venenatis. Mauris porta elementum velit.\r\nPellentesque nibh dolor, molestie in, ultrices at, accumsan sit amet, massa. <\/p>\r\n<p\/>\r\n\r\n<\/div>\r\n\r\n\r\n<\/body>\r\n<\/html>\r\n<\/pre>\n
\n<\/a><\/p>\n