Yii 1.1: scrolltop

An handy jquery scrolltop script animated.
22 followers

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'
)); ?>

Github

https://github.com/sensorario/scrolltop

Total 6 comments

#5441 report it
Raoul at 2011/10/12 08:11am
useful..thanks

thanks sensorario, its a simple and useful extension !

#5440 report it
sensorario at 2011/10/12 07:12am
github

ok!! Now the project is on github =). If anyone want contribute, fork, or make some pull request ... any suggestions are wellcome!

#5439 report it
yiqing95 at 2011/10/12 06:31am
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));
);
#5434 report it
sensorario at 2011/10/12 03:01am
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)

#5433 report it
gsd at 2011/10/12 02:38am
simple

simple

<?php echo CHtml::link('^top', '#', array('onclick'=>'js:$("html,body").animate({ scrollTop : 0 }, "slow");return false;'))?>
#5432 report it
Peter JK at 2011/10/12 02:34am
ahaaa.. simple but usefull

thx sensorasio...

Leave a comment

Please to leave your comment.

Create extension