Yii Framework Forum: [ask] menggunakan CclientScript - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[ask] menggunakan CclientScript menggunakan CclientScript untuk jQueryCycle Rate Topic: -----

#1 User is offline   chayo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 08-April 11

Posted 11 April 2011 - 04:37 AM

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
0

#2 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 11 April 2011 - 09:51 PM

setau ane buat masukkin script bukan pakai registerScriptFile() tetapi pakai registerScript() saja. Mungkin coba diganti nama fungsinya trus dites lagi jalan apa nggak~
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#3 User is offline   chayo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 08-April 11

Posted 12 April 2011 - 07:26 AM

View Postjunxiong, on 11 April 2011 - 09:51 PM, said:

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 :)
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users