Results with 2 jQuery plugins + CHtml link

What are your results?

I got it working, but for some reason the jQuery plugins won’t work unless I have a CHtml link on the page.

I add the following to the page to register scripts:


 Yii::app()->clientScript->registerScriptFile(

    Yii::app()->assetManager->publish(

	

        Yii::getPathOfAlias('application.components').'/jquery.innerfade.js'

    ),

    CClientScript::POS_END

);


Yii::app()->clientScript->registerScriptFile(

    Yii::app()->assetManager->publish(

        Yii::getPathOfAlias('application.components').'/jquery.jticker.js'

    ),

    CClientScript::POS_END

);




And then some script code:


<script type="text/javascript">

<!--

  jQuery(document).ready(function(){

    // Instantiate jTicker 

	jQuery("#ticker").ticker({

 		cursorList:  " ",

 		rate:        30,

 		delay:   	4000

	}).trigger("play").trigger("stop");


    // Trigger events 

    jQuery(".stop").click(function(){

        jQuery("#ticker").trigger("stop");

        return false;

    });

    

    jQuery(".play").click(function(){

        jQuery("#ticker").trigger("play");

        return false;

    });

    

    jQuery(".speedup").click(function(){

        jQuery("#ticker")

        .trigger({

            type: "control",

            item: 0,

            rate: 10,

            delay: 4000

        })

        return false;

    });

    

    jQuery(".slowdown").click(function(){

        jQuery("#ticker")

        .trigger({

            type: "control",

            item: 0,

            rate: 90,

            delay: 8000

        })

        return false;

    });

    

    jQuery(".next").live("click", function(){

        jQuery("#ticker")

        .trigger({type: "play"})

        .trigger({type: "stop"});

        return false;

    });


    jQuery(".style").click(function(){

        jQuery("#ticker")

        .trigger({

            type: "control",

            cursor: jQuery("#ticker").data("ticker").cursor.css({width: "4em", background: "red", position: "relative", top: "1em", left: "-1em"})

        })

        return false;

    });

  	

  });


//-->

</script>

Add this makes them work:


CHtml::link("Link","#", array("submit"=>array("etc", 'id'=>$model->id)));

But removing it breaks the jQuery.

Bug?? - what are your results?

EDIT: For reference, the jQuery plugins are InnerFade & JTicker. It could be a conflict with them, not sure.

EDIT2: For what its worth… a "fix" for now is to insert blank CHtml into page:


CHtml::link('','#', array("submit"=>array("", 'id'=>null))); 

CHtml::link() will execute these two lines




  $cs=Yii::app()->getClientScript();

  $cs->registerCoreScript('jquery');



/Tommy

Ok, for some reason I thought jQuery was being called all the time (yii built with jQuery?).

I guess I need to call it like you’re saying than.

Thanks.