This widget do this:
$('html, body').animate({ scrollTop : 0 }, 'slow');
Install ¶
Copy ScrollTop.php script in /protected/extensions folder.
Requirements ¶
Yii 1.1 or above
Usage ¶
Simplest way to use this widget:
<?php $this->widget('ext.ScrollTop'); ?>
Configurable
<?php $this->widget('ext.ScrollTop',array(
'label' => 'Go on top',
'speed' => 'slow'
)); ?>
ahaaa.. simple but usefull
thx sensorasio...
simple
simple
<?php echo CHtml::link('^top', '#', array('onclick'=>'js:$("html,body").animate({ scrollTop : 0 }, "slow");return false;'))?>
A little bug =)
I've found a little bug. Using more time this widget, cause a conflict and animation dont start. I've already fix it and uploaded new zip archive.
@simple
A friend tell me: Keep It Simple Stupid!
(maybe this widget is too simple :-p jajaja)
kiss
hehehe :) ; simple ! it 's helpful , may be one can make the to top link more beautiful , a back-ground gif picture is not bad .
suggestion :
expose more options of the "a" element ,use the CHtml::link();
echo '<a href="#" id="' . ($this->id) . '">' . ($this->label) . '</a>'; //better to be : public $linkOptions = array(); //add a public var you can add more such as css class echo CHtml::link($this->label,$url='#',CMap::mergeArray(array('id'=>$this->id),$this->linkOptions)); );
github
ok!! Now the project is on github =). If anyone want contribute, fork, or make some pull request ... any suggestions are wellcome!
useful..thanks
thanks sensorario, its a simple and useful extension !
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.