Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

71 lines (52 sloc) 2.864 kb
note : this extension originally is a fork of http://www.yiiframework.com/extension/scrolltop/ .
but the old one is need some more functionality so i fork it from sensorario(http://www.yiiframework.com/user/6712/)
scrollTo ' s default behavior is scroll to the top of the document , but you can also set an html tag 's id ,this is
why this extension is named scrollTo but scrollTop .
if you need scroll from some link element to top please check out the original version :http://www.yiiframework.com/extension/scrolltop/
how to use it
first check out this extension and put it to your protected/extensions dir
or some orther dir, then just use the path alias to refer it , i don't know you will put it to
where but just use path alias of this widget . for me i just put it to my costumized dir .
if you put it to extension dir , you can change the following path alias 'common.widgets.KScrollToWidget'
to 'ext.KScrollToWidget' or 'ext.KScrollToWidget.KScrollToWidget' , just depends on your situation , if you don't
understand how to use the path alias please refer to http://www.yiiframework.com/doc/api/1.1/YiiBase#getPathOfAlias-detail
or some wiki , forum topics
in your view file :
<div style="height:600px">
click the following there button to see the effects
</div>
<div id='dest' > the left widget will scroll to here </div>
<div style="height:1200px">
click the following there button to see the effects
</div>
<?php
// echo str_repeat('<br/>',65)."\n";
$this->widget('common.widgets.KScrollToWidget',array(
'label' => 'Go on top',
'speed' => 'slow',
'cssSettings'=>array(
'background-color'=> '#78901f',
'width'=>'200px'
)
));
?>
<?php
$this->widget('common.widgets.KScrollToWidget',array(
'label' => 'toTop2',
'speed' => 2000,
'position'=> 'center',
'dest'=> 100,
'cssSettings'=>array(
// 'background-color'=> '#446477'
)
)); ?>
<?php
$this->widget('common.widgets.KScrollToWidget',array(
'label' => 'scroll to the dest div',
'speed' => 200,
'destination' => 'dest' ,
'position'=> 'left',
'cssSettings'=>array(
'background-color'=> '#f26077'
)
)); ?>
Jump to Line
Something went wrong with that request. Please try again.