Thursday, April 1
Monday, July 13
Show lightbox thickbox effect on page load
Lightbox or thickbox basically used to show image or new page in lightbox transparent effect on click event of any image or link .We can show same effect when page is load. This can be achieve just using the following code snippet in head tag.
<code><script rc="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript" src="js/thickbox.js"></script>
<script type="text/javascript">
$(document).ready(function() {
tb_show('', 'college1/college.php?keepThis=true&TB_iframe=true&height=470&width=675', null);
});
</script>
</code>
Tuesday, June 30
Show Hide div tag or paragraph tag or html element
To show hide any element that elemnet must have some class or id .
Here we are using div element as example
1. The Html code is as given below
<a href="javascript:;" onclick="show_div();">Show</a>
<a href="javascript:;" onclick="hide_div();">hide</a>
<div class="div1" id="dav1">
<p>We are using this div to demonstrate show/hide code.</p>
<p>dreamtechworld is conducting computer training for php and mysql</p>
</div>
2.Now write Javascript Code
<script>
function show_div()
{
$("div1").
show("slow");
}function hide_div()
{
$("div1").
hide("slow");
}</script>
3.Demo
Show Hide
We are using this div to demonstrate show/hide code.
DreamTechWorld is conducting computer training for php and mysql.
EXPLANATION :
A.In above code we are accessing div by its class i.e. $(".div") we can use id too
e.g. $("#dav")
show and hide are various methods defined in jquery.
There are three methods
1.show - show the hidden element
2.hide - hide visible element
3.toggle-do alternate action according to current status
B.Parameter
1.slow e.g $("div1").show("slow");
2.fast e.g $("div1").show("fast");
3.speed in number e.g $("div1").show(400);
Subscribe to:
Posts (Atom)