当<div>元素向上滑动时,停止滚动条出现

时间:2016-08-18 15:58:06

标签: jquery html css

我正在使用jQuery来制作滑动功能。当<div>元素向上滑动时,由于命令overflow:auto而出现滚动条,当文本溢出<div>时,该命令会创建滚动条。但是,在滑动的情况下,我不希望这种情况发生。

当用户切换内容上下滑动时,如何停止显示滚动条?

1 个答案:

答案 0 :(得分:0)

  1. 您可以使用&#39; overflow:none&#39;
  2. 在切换功能中,您可以通过在切换操作之前编写private void switchCameras() { mCameraOpenCloseLock.release(); mCameraDevice.close(); CameraManager mCameraManager = (CameraManager) getActivity().getSystemService(Context.CAMERA_SERVICE); try { String mCameraId = mCameraManager.getCameraIdList()[0]; if (mCameraId.equals("0")) { // If currently on FRONT camera (0 = CameraCharacteristics.LENS_FACING_FRONT) mCameraId = "1"; // switch to BACK camera (1 = CameraCharacteristics.LENS_FACING_BACK) switchCameraButton.setImageResource(R.drawable.ic_camera_front); } else { // If currently on BACK camera mCameraId = "0"; // switch to front camera switchCameraButton.setImageResource(R.drawable.ic_camera_back); } try { if (ActivityCompat.checkSelfPermission(getActivity(), Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { mCameraManager.openCamera(mCameraId, mStateCallback, null); } else { requestVideoPermissions(); } } catch (CameraAccessException e) { e.printStackTrace(); } } catch (CameraAccessException e) { Toast.makeText(getActivity(), "Cannot access the camera.", Toast.LENGTH_SHORT).show(); getActivity().finish(); } } 来设置溢出为无,并在操作结束时写入$(element).css('overflow', 'none')再次返回。