星期三, 10月 01, 2008

浮動div

1.jQuery本身draggable
jQuery UI/Draggable
include三個檔案即可使用
< script src="http://code.jquery.com/jquery-latest.js">< /script>
< script src="http://ui.jquery.com/latest/ui/ui.core.js">< /script>
< script src="http://ui.jquery.com/latest/ui/ui.draggable.js">< /script>


只要對某tag下draggable()就ok啦
$(".block").draggable();


2.jquery插件:任意位置浮动固定层
demo DEMO下載

可以任意定住div的在網頁的位置,在滾動頁面時也會保持在同一個位置
下載檔案後,解開將"jquery.floatDiv.js"檔include即可使用

/*调用:
1 无参数调用:默认浮动在右下角
$("#id").floatdiv();

2 内置固定位置浮动
//右下角
$("#id").floatdiv("rightbottom");
//左下角
$("#id").floatdiv("leftbottom");
//右下角
$("#id").floatdiv("rightbottom");
//左上角
$("#id").floatdiv("lefttop");
//右上角
$("#id").floatdiv("righttop");
//居中
$("#id").floatdiv("middle");

3 自定义位置浮动
$("#id").floatdiv({left:"10px",top:"10px"});
以上参数,设置浮动层在left 10个像素,top 10个像素的位置
*/

沒有留言: