美文网首页
2019-06-172019-06-14(前端第十五节知识点(j

2019-06-172019-06-14(前端第十五节知识点(j

作者: 彝_e37e | 来源:发表于2019-06-17 19:21 被阅读0次

    尺寸相关、滚动事件:

    1、获取和设置元素的尺寸

    width()、height()    获取元素width和height 

    innerWidth()、innerHeight()  包括padding的width和height 

    outerWidth()、outerHeight()  包括padding和border的width和height 

    outerWidth(true)、outerHeight(true)  包括padding和border以及margin的width和height

    2、获取元素相对页面的绝对位置

    offset()

    3、获取可视区高度

    $(window).height();

    4、获取页面高度

    $(document).height();

    5、获取页面滚动距离

    $(document).scrollTop(); 

    $(document).scrollLeft();

    6、页面滚动事件

    $(window).scroll(function(){ 

        ...... 

    })


    鼠标移入移出:

    进入子元素也触发

    $('#div1').mouseover(function() {

    $(this).animate({marginTop: 50});//.stop()

    });

    $('#div1').mouseout(function() {

    $(this).animate({marginTop: 100});//.stop()

    });

    进入子元素不触发*/

    $('#div1').mouseenter(function() {

    $(this).stop().animate({marginTop: 50});

    });

    $('#div1').mouseleave(function() {

    $(this).stop().animate({marginTop: 100});

    });

    通过hover(mouseenter+mouseleave)实现简写

    相关文章

      网友评论

          本文标题:2019-06-172019-06-14(前端第十五节知识点(j

          本文链接:https://www.haomeiwen.com/subject/txbzfctx.html