scroll_to_top.module in scroll to top 6
Same filename and directory in other branches
Provide scroll to top link.
File
scroll_to_top.moduleView source
<?php
/**
* @file
* Provide scroll to top link.
*/
/**
* Implementation of hook_init().
*/
function scroll_to_top_init() {
drupal_add_css(drupal_get_path('module', 'scroll_to_top') . '/scroll_to_top.css', 'module');
drupal_add_js(drupal_get_path('module', 'scroll_to_top') . '/scroll_to_top.js', 'module');
$position = "";
if (variable_get('scroll_to_top_position', 1) == 1) {
$position = "\$('#back-top').css('right','40px');";
}
if (variable_get('scroll_to_top_position', 1) == 3) {
$position = "\$('#back-top').css({'left':'50%','margin':'0px'});";
}
if (variable_get('scroll_to_top_display_text', TRUE) == FALSE) {
$display = "\$('div#link').css('display','none');";
}
$bgcolor = " \$('#back-top span').mouseover(function(){ \$(this).css('background-color','" . variable_get('scroll_to_top_bg_color_hover', '#777777') . "');}).mouseout(function(){ \$(this).css('background-color','" . variable_get('scroll_to_top_bg_color_out', '#CCCCCC') . "');});";
$script = "\$(document).ready(function() {";
$script .= $position;
$script .= $bgcolor;
$script .= $display;
$script .= "});";
drupal_add_js($script, 'inline');
}
/**
* Implements hook_menu().
*/
function scroll_to_top_menu() {
$items = array();
$items['admin/settings/scrolltotop'] = array(
'title' => 'Scroll to top',
'description' => 'Scroll To Top stettings',
'page callback' => 'drupal_get_form',
'page arguments' => array(
'scroll_to_top_settings',
),
'access arguments' => array(
'access administration pages',
),
'file' => 'scroll_to_top.admin.inc',
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
Functions
Name![]() |
Description |
---|---|
scroll_to_top_init | Implementation of hook_init(). |
scroll_to_top_menu | Implements hook_menu(). |