Greasy Fork

Sticky mTurk Search Bar

sticks mturk searchbar on scroll

当前为 2014-09-06 提交的版本,查看 最新版本

// ==UserScript==
// @name       Sticky mTurk Search Bar
// @version    0.11
// @author zingy
// @description  sticks mturk searchbar on scroll
// @require http://code.jquery.com/jquery-latest.min.js
// @match https://www.mturk.com*
// @match https://www.mturk.com/mturk*
// @match https://www.mturk.com/mturk/findhits?match=false*
// @match https://www.mturk.com/mturk/dashboard*
// @match https://www.mturk.com/mturk/findquals?requestable=false&earned=true*
// @match https://www.mturk.com/mturk/myhits*
// @match https://www.mturk.com/mturk/findhits?match=true*
// @match https://www.mturk.com/mturk/searchbar*
// @copyright  2012+, You
// @namespace https://greasyfork.org/users/2698
// ==/UserScript==

jQuery(function($) {
    function fixDiv() {
      var $cache = $('#searchbar'); 
      if ($(window).scrollTop() > 100) 
        $cache.css({'position': 'fixed', 'top': '10px'}); 
      else
        $cache.css({'position': 'relative', 'top': 'auto'});
    }
    $(window).scroll(fixDiv);
    fixDiv();
});