jQuery4PHP - 使用PHP对象来编写JavaScript代码

分享到:
logo_jquery4php_285x60.jpg
jQuery4PHP ( jQuery for PHP ) 是一个PHP5库,可以让开发人员使用PHP对象轻松编写javascript代码(jQuery语法)。以一种简便的方式来开发RIA应用,而不需要了解javascript语言。拥有大量 UI 组件,和许多 jQuery 插件支持。
<button id="go1">&raquo; Animate Block1</button>
<button id="go2">&raquo; Animate Block1</button>
<button id="go3">&raquo; Animate Both</button>

<button id="go4">&raquo; Reset</button>
<div class="block_animate" id="block1">Block1</div>
<div class="block_animate" id="block2">Block1</div>

<?php
echo
YsJQuery::newInstance()
  ->onClick()
  ->in('#go1')
  ->execute(
YsJQuery::animate()
->in('#block1')
->properties(array('width' => "90%"))
,
YsJQuery::animate()
->properties(array('fontSize' => '24px'))
->duration(1500)
,
YsJQuery::animate()
->properties(array('borderRightWidth' => '15px'))
->duration(1500)
  );

echo
YsJQuery::newInstance()
  ->onClick()
  ->in('#go2')
  ->execute(
YsJQuery::animate()
->in('#block2')
->properties(array('width' => "90%"))
,
YsJQuery::animate()
->properties(array('fontSize' => '24px'))
->duration(1500)
,
YsJQuery::animate()
->properties(array('borderLeftWidth' => '15px'))
->duration(1500)
  );

YsJQuery::newInstance()
  ->onClick()
  ->in('#go3')
  ->execute(
YsJQuery::add('#go2')->in('#go1'),
YsJQuery::click()
  )
  ->write();

YsJQuery::newInstance()
  ->onClick()
  ->in('#go4')
  ->execute(
YsJQuery::css()
->in('#block1, #block2')
->properties(array('width' => "",
'fontSize' => "",
'borderWidth' => ""))
  )
  ->write()
?>

项目主页:http://www.open-open.com/lib/view/home/1349601300385

昵    称:
验证码:

相关文档: