[ask] menggunakan CclientScript

agan-agan, akang-akang, mas-mas, abang-abang, dan ade-ade yang saya hormati… saya ada kesulitan penggunaan cclientscript untuk memasukan jquery.cycle.all.

script saya sebagai berikut:


<?php

$cyclepath=Yii::app()->assetManager->publish(YII::app()->basePath.'scripts/cyclease/');

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

$cs->registerCoreScript('jquery');

$cs->registerScriptFile($cyclepath.'/jquery.cycle.all.js');

//$cs->registerScriptFile($cyclepath.'/jquery.min.js');

$cs->registerScriptFile($cyclepath.'/jquery.easing.1.1.1.js');

$cs->registerCssFile($cyclepath.'/heroimage.css');

?>


<?php 

$cs ->registerScriptFile('eascyle',"

$f.n.cycle = {

speed:1000,

speedIn:null,

speedOut:null,

easing:null,

easeIn:null,

easeOut:null };", CClientScript::POS_HEAD) ?>




<?php 

$cs ->registerScriptFile('cyclease',"

$('#left-hero').cycle({

fx: 'scrollDown',

speedIn:2000,

speedOut:500,

easeIn:'bounceout',

easeOut:'backin',

delay: -2000

});

$('#heroimage').cycle({

	fx: 'costum',

	sync:0,

cssBefore:{

top:0,

left:800,

display:'block'

},

animIn:{

left:0

},

animOut: {

top:500

},

delay:-3000});", CClientScript::POS_READY);?>

tapi script nya ga jalan kalau saya chek pake google developer tools ada error di script di file jquery.js error nya:jquery.js:869Uncaught Type Error: property ‘cycle’ of object [object Object]is not a function,

terus saya coba hilangkan comment jquery.min.js

masih error juga tapi error nya di bagian


('#left-hero').cycle({

(x)index.php:112Uncaught TypeError: Property ‘cycle’ of object #<object> is not a function. gimana atuh supaya bisa jalan ya?? pusing nyari2 sampe mau :-X muntah nih… soalnya OOP saya masih Orang-orangan Pusing hehehehe… Mohon bantuan nya ya :D

setau ane buat masukkin script bukan pakai registerScriptFile() tetapi pakai registerScript() saja. Mungkin coba diganti nama fungsinya trus dites lagi jalan apa nggak~

ia pake registerScript() kk, kemarin di salah ketik hehehe… :D . dan setelah diutak-atik lagi, ternyata jquery.cycle.all nya harus di post_end baru bisa hehe. script nya jadi begini:


<?php

$cyclepath=Yii::app()->assetManager->publish(YII::app()->basePath.'scripts/cyclease/');

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

$cs->registerCoreScript('jquery');

$cs->registerScriptFile($cyclepath.'/jquery.cycle.all.js',CClientScript::Post_END);

//$cs->registerScriptFile($cyclepath.'/jquery.min.js');

$cs->registerScriptFile($cyclepath.'/jquery.easing.1.1.1.js');

$cs->registerCssFile($cyclepath.'/heroimage.css');

?>


<?php

$cs ->registerScript('eascyle',"

$f.n.cycle = {

speed:1000,

speedIn:null,

speedOut:null,

easing:null,

easeIn:null,

easeOut:null };", CClientScript::POS_HEAD) ?>




<?php

$cs ->registerScript('cyclease',"

$('#left-hero').cycle({

fx: 'scrollDown',

speedIn:2000,

speedOut:500,

easeIn:'bounceout',

easeOut:'backin',

delay: -2000

});

$('#heroimage').cycle({

        fx: 'costum',

        sync:0,

cssBefore:{

top:0,

left:800,

display:'block'

},

animIn:{

left:0

},

animOut: {

top:500

},

delay:-3000});", CClientScript::POS_END);?>

thanks for the reply and have a great day :)