예제 #1
0
/**
 * Enable a link_button or button
 * @param String $selector The jQuery Selector
 * @param String $funtion The function to bind. Needed to enable a link_button
 * @param boolean $isInternal
 */
function ui_enable_button($selector, $funtion = '', $isInternal = true)
{
    if (!function_exists('ui_effects')) {
        use_helper('ysJQueryUIEffects');
    }
    $sintax = '';
    $sintax = jquery_set($selector, 'attr', array('disabled' => ''), $unescapeId = true, $accesors = '', $addSeparator = true);
    if ($funtion != '') {
        $sintax = jquery_bind_event($selector, 'click', $funtion);
    }
    $sintax .= ui_effects_remove_class($selector, array('class' => 'ui-state-disabled'));
    $sintax .= ui_effects_add_class($selector, array('class' => 'ui-state-default'));
    if ($isInternal) {
        return $sintax;
    } else {
        return add_jquery_support($selector, 'ready', like_function($sintax));
    }
}
예제 #2
0
<?php 
echo jquery_execute(jquery_hover_event('li', array(like_function('$(this).append($("<span> ******** </span>"));'), like_function('$(this).find("span:last").remove();'))));
?>

<br>

<hr>
<h3>Bind & Unbind - example</h3>

<input type="button" value="Bind" id="btnBind">
<input type="button" value="UnBind" id="btnUnBind">

<div id="bindExample">Click me</div>

<?php 
echo add_jquery_support('#btnBind', 'click', like_function(jquery_bind_event('#bindExample', 'click', array('foo' => 'bar'), like_function('alert(event.data.foo)', 'event'))));
?>


<?php 
echo add_jquery_support('#btnUnBind', 'click', like_function(jquery_unbind_event('#bindExample')));
?>
<br>

<hr>
<h3>One event - example</h3>

<input type="button" value="One event" id="btnOneClick">

<?php 
echo add_jquery_support('document', 'ready', like_function(jquery_one_event('#btnOneClick', 'click', like_function('alert( "Only " + $(this).val() );'))));