复制代 代码如下: jquery窗口震動特效 <BR>;(function($){ <BR>var element = {}; <BR>$.fn.jshaker = function(){ <BR>element = $(this); <BR>element.css('位置', '相対'); <BR>element.find('*').each(function(i, el){ <BR>$(el).css('位置', '相対'); <BR>}); <BR>var iFunc = function(){ $(element)) }; <BR>setTimeout(iFunc, 50); fn.jshaker.animate = function(el){ <BR>$.fn.jshaker.shake(el); <BR>el.find('*').each(function(i, el){ <BR>$ .fn.jshaker.shake(el); <BR>var iFunc = function(){ $.fn.jshaker.animate(el) }; 🎜>} <BR>$.fn.jshaker.shake = function(el){ <BR>var pos = $(el).position(); <BR>if(Math.random() > 0.5){ <BR>$(el).css('top', pos['top'] Math.random() * 20 < 10 ? (Math.random() * 20 * (-1)) : Math.random() * 20); <BR>} else { <BR>$(el).css('left', pos['left'] Math.random() * 20 < 10 ? (Math.random() * 20 * (-1)) : Math.random() * 20); <BR>} <BR>} <BR>})(jQuery); <BR> <BR>$(document).ready(function(){ <BR>$('.block').click(function(){ <BR>$(this).jshaker(); <BR>}); <BR>}); <BR> <BR>BODY{font-family: "Lucida Grande"、Arial、Helvetica、サンセリフ;color: #666666;font-size: 12px;background: #FFFFFF;} <BR>A{color: #0A8ECC;} <BR>A: HOVER{テキスト装飾: なし;カラー: #8FCB2F;} <BR>H1{フォントの太さ: 通常;カラー: #0A8ECC;マージン: 0;パディング: 0;} <BR>BODY{マージン: 20px;パディング: 20px;} <BR>STRONG{color: #000000;} <BR>.vspacer{height: 20px;} <BR>PRE.code{padding: 7px;background: #777777;color: #F0F0F0 ;width: 400px;overflow: auto;} <BR>#content-area{border: 3px ソリッド #CCCCCC;background: #F0F0F0;padding: 10px;width: 500px;} <BR>P.script-link{clear:両方;パディング: 10px 0;border-top: 1px 点線 #CCCCCC;} <BR>#content .block {float: left;border: 1pxソリッド #CCCCCC;background: #F0F0F0;padding: 10px;margin: 10px;width : 300px;} <BR> jquery窗口震動特效 点击本框内,可实现震動 項目 1 項目 2 項目 3 サブ項目 1 サブアイテム 2 サブアイテム 3 サブ項目 4 サブ項目 5 項目 4 項目 5 テキスト フィールド 1: テキスト フィールド 2: 送信