如何使div固定在滚动和按钮点击 [英] how to make div fixed at a scroll and buttton click

查看:200
本文介绍了如何使div固定在滚动和按钮点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想让一个特定的侧面div固定在一个特定的滚动级别。这个div有listview.At页面加载固定的div工作得很好,但我点击一个按钮并更新listview一次固定div没有工作。这怎么可能 ?用css或jquery。

解决方案

我在这里猜一个问题。



你正在做所有的事情更改 jQuery 加载方法。当您正在执行任何其他事件并更新任何控件时,因为您正在为ListView执行此操作,因此如果您使用 Ajax UpdatePanel 或其他内容,那么Page将不会刷新。



如果Page不刷新,则它不会执行你在 jQuery的加载事件中编写的代码



所以,我建议你把一个调试器放在这个 jQuery 加载事件中,看看是否有在更新 ListView 时会遇到这种情况。如果没有,那么你必须在更新 ListView 时执行相同的代码。


我尝试点击注册脚本



 ScriptManager.RegisterClientScriptBlock( this  .Page, this  .GetType(),  MyScript  scrolltop(); true ); 



功能是





  function  scrolltop(){

var


sidebar =

I want to make a particular side div fixed at a particular scroll level.This div have listview.At pageload the fixed div is work well but i click one button and update listview at a time fixed div not worked. How is it possible ? with css or jquery.

解决方案

I am guessing one issue here.

You are doing all the changes in jQuery load method. When you are doing any other event and updating any control as you are doing it for ListView, so if you use Ajax UpdatePanel or something for that, so Page would not refresh.

If Page don't refresh, then it will not execute the codes which you have written in load event of jQuery.

So, I would suggest you to put a debugger inside this jQuery load event and see if it is hitting that when you update the ListView. If not, then you have to execute the same code while updating the ListView.


I try onclick with register script

ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "MyScript", "scrolltop();", true);


function is


function scrolltop() {
          
            var


sidebar =


这篇关于如何使div固定在滚动和按钮点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆