jQuery4PHP - 使用PHP對象來編寫JavaScript代碼
jQuery4PHP ( jQuery for PHP ) 是一個PHP5庫,可以讓開發人員使用PHP對象輕松編寫javascript代碼(jQuery語法)。以一種簡便的方式來開發RIA應用,而不需要了解javascript語言。擁有大量 UI 組件,和許多 jQuery 插件支持。
<button id="go1">» Animate Block1</button> <button id="go2">» Animate Block1</button> <button id="go3">» Animate Both</button><button id="go4">» 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() ?></pre>