Sunday, 1 November 2009

MopBox : unique tip box for Blogger using Jquerry

Do you need a tip box to illustrating your words ? MopBox is what we need to create tip box .It's draggable tip box that can contain div, image , flashmovie, video, etc .
Mopbox can make two kind of tip box : one disappear when mouse out and one need to click on button to close .

Live demo here

To make tip box with Mopbox script ,go through steps below :
1, Download file Mopbox here
unzip this package ,you will see 4 files . Upload them to your hosting service .
2, Open template file ,insert these line before : </head>

<link href="your_hosting/mopTip-2.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="your_hosting/jquery-1.js"></script>
<script type="text/javascript" src="your_hosting/mopTip-2.js"></script>
<script type="text/javascript" src="your_hosting/jquery1a.js"></script>

Save template .Ok .Remember to change the red code to your file URL
Now go to Page elements and create a new HTML/Javascript widget
Paste this code into Widget content :

<script type="text/javascript">
$(document).ready(function(){
$("#demo1Btn").mopTip({'w':150,'style':"overOut",'get':"#demo1"});
$("#demo2Btn").mopTip({'w':150,'style':"overClick",'get':"#demo2"});
});
</script>

<style type="text/css">
*{
margin: 0;
padding: 0;
}

.f14 {
font-size: 14px;
font-weight: bold;
}

.navi:link {
color: #AE0000;
text-decoration: none;
}
.navi:visited {
color: #AE0000;
text-decoration: none;
}
.navi:hover {
color: #AE0000;
text-decoration: underline;
}

#tipBox1 {
position: absolute;
left: 150px;
top: 120px;
}

#tipBox2 {
margin-top: 150px;
text-align: center;
}
</style>


<div id="tipBox2">
<a id="demo2Btn" style="cursor: default;" class="navi f14" href="#?moptip">demo2</a>
</div>

<div id="tipBox1">
<div><a id="demo1Btn" style="cursor: default;" class="navi f14" href="#?moptip">demo1</a></div>
</div>


<div style="display:none">
<div id="demo1">"overOut" txt txt txt txt txt txt txt</div>
<div id="demo2">"overClick" txt txt txt txt txt txt txt</div>
</div>

Save it . Ok ,you are done .
Now ,let's go deeper inside the code .
here is the code of words which tip box will be showed if mouse over .

<div id="tipBox2">
<a id="demo2Btn" style="cursor: default;" class="navi f14" href="#?moptip">demo2</a>
</div>

<div id="tipBox1">
<div><a id="demo1Btn" style="cursor: default;" class="navi f14" href="#?moptip">demo1</a></div>
</div>

Here is contents of tip boxes :

<div style="display:none">
<div id="demo1">"overOut" txt txt txt txt txt txt txt</div>
<div id="demo2">"overClick" txt txt txt txt txt txt txt</div>
</div>

Content of tip boxes can be text,image ,video .... anything you want .
here is the javascript code which control the appearance of tip boxes :

<script type="text/javascript">
$(document).ready(function(){
$("#demo1Btn").mopTip({'w':150,'style':"overOut",'get':"#demo1"});
$("#demo2Btn").mopTip({'w':150,'style':"overClick",'get':"#demo2"});
});
</script>

In script above ,you will see demo1Btn and demo2Btn are id of elements which need to illustrating by tip boxes .
'w':150 is the width of tip box
overOut mean tip box will disappear when mouse out
overClick mean you have to click on X button to close tip box .
demo1 and demo2 are id of div layout which contain tip-box 's content



huy signature

4 comments:

  1. DEmo link not working i guess

    ReplyDelete
  2. What should i do if i need multiple pop up of style demo1

    ReplyDelete
  3. In the zip is not the template file... Thanks...

    ReplyDelete
  4. @RockyRiderz : Just duplicate the code above ,for example ,we got a code for demo1 and demo2 ,you can duplicate all the code contain word demo1 and demo2 ,and change the demo1 demo2 to any you want ,for example demo3 ,demo4... You will see how it work and you can make your own . It's better than I write all the code and a long comment for explaination .
    @Variopinto : This is file for Jquery plugin .Not blogger template file .

    ReplyDelete