PHP jQuery Class

This is a very interesting code snippets to construct a class that gives you access to all the power of jQuery
{code type=php}<?php

class Jquery {

function animate($trigger, $element, $event, $time) {

echo<script>

$(function() {

$($trigger).$event(function() {

$(#$element’).slideDown($time);

});

});

</script>;

;
}
}

?>

<html>

<head>
<meta http-equiv=”Content-type” content=”text/html; charset=utf-8″>
<title>jquery class</title>

<script type=”text/javascript” charset=”utf-8″ src=”http://code.jquery.com/jquery-1.5.1.js”>

</script>

<style>

#paragraph {display:none;}

</style>

</head>

<body id=”jquery” onload=”">

<?
$trigger=#trigger”;
$element = “paragraph”;
$event = “click”;
$time =500;

$slide = new Jquery();
echo $slide->animate($trigger, $element, $event, $time);
?>

<a id=”trigger” href=”#”>click me</a>
<div id = “paragraph”>my paragraph</div>

</body>

</html>{/code}

All PHP Scripts on this website are provided by phpscripts4u.com where you can find all the latest PHP code snippets, plugins and libraries.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>