【问题标题】:I want to change "document" to "id" in jquery我想在jquery中将“document”更改为“id”
【发布时间】:2015-09-17 06:57:55
【问题描述】:

我想在这个脚本的 jquery 中将 document 更改为 id

$(document).on("scroll",function(){       
   if($(document).scrollTop()>100){
      $("#brand1h1").removeClass("screen_block_title").addClass("screen_block_title2");
   } else {
      $("#brand1h1").removeClass("screen_block_title2").addClass("screen_block_title");
   }
});

我不想在页面滚动上更改,我想在页面中间指定特定的 id

【问题讨论】:

  • 你的问题不清楚。清楚地添加要求。
  • 请检查下面的链接有dirrerent 3块,当我使用“文档”滚动100px效果进入所有块paraminfosolutions.com/hooplakidz-screen/brand.html
  • 我想要脚本激活,当块来临时
  • 请检查链接 Varun , Jai

标签: javascript jquery html jquery-ui jquery-plugins


【解决方案1】:

我认为您正在寻找类似的东西,如果没有,请告诉我。

$("#d").on("scroll",function(){       
   if(1==1){  //CHANGE IF CONDITION AS NEEDED
      alert("Scrolled");
   } else {
       //ELSE CODE HERE 
   }
});
#d
{
    height:40px;
    overflow-y:scroll;
    
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<DIV id="d">
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>

【讨论】:

  • 为什么投反对票,原来的问题只问这个,后来添加了链接等
  • 请检查我的链接页面代码,里面有多个块
猜你喜欢
  • 1970-01-01
  • 2017-11-11
  • 2016-05-09
  • 2014-07-18
  • 1970-01-01
  • 1970-01-01
  • 2019-05-02
  • 2023-03-24
  • 1970-01-01
相关资源
最近更新 更多