如何从此站点禁用鼠标滚轮

时间:2019-04-06 00:43:25

标签: javascript php jquery

我有一个网站,我想从this site禁用鼠标滚轮。

<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>

<!DOCTYPE html>
<html lang="fr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="author" content="drive visite">
    <meta name="copyright" content="">
    <meta name="description" content="Visite virtuelle 360 by drive visite logiciel panoramique">
    <title>Drive visite 360 </title>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'assets/css/font-awesome.min.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'assets/css/style.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/tooltipster/css/tooltipster.bundle.min.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/tooltipster/css/plugins/tooltipster/sidetip/themes/tooltipster-sidetip-borderless.min.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/lightslider/lightslider.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/jssocials/jssocials.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/jssocials/jssocials-theme-plain-color.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/idvisite/ivisitepano.css'; ?>">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url() . 'lib/idvisite/idvisite.theme.visitepano.css'; ?>">
  </head>

  <body>
    <div class="fstpn-ui-page">
      <div class="fstpn-ui-dvisite-wrap">
        <div class="fstpn-ui-dvisite" id="dvisite"></div>
        <?php if(sizeOf($scenes) > 1) { ?>
        <div id="dvisite-slider-wrap" class="fstpn-ui-dvisite-slider-wrap fstpn-ui-hidden">
          <div class="fstpn-ui-dvisite-slider-toggle fstpn-ui-hidden"></div>
          <ul id="dvisite-slider" class="fstpn-ui-dvisite-slider">
            <?php foreach($scenes as $key => $scene) { ?><?php $imageThumb = ($scene['imageThumb']['url'] ? $scene['imageThumb'] : $scene['image']); ?>
            <li>
              <div class="fstpn-ui-dvisite-slider-thumb" data-scene="<?php echo 'scene' . $key; ?>" <?php echo 'scene' . $key; ?> <?php echo ($scene['title'] ? 'title="' . $scene['title'] . '"' : '') ?>><img src="<?php echo ($imageThumb['isCustom'] ? $imageThumb['url'] : $uploadUrl . $imageThumb['url']); ?>" alt=""></div>
            </li>
            <?php } ?>
          </ul>
        </div>
        <?php } ?>
        <div id="dvisite-share-wrap" class="fstpn-ui-dvisite-share-wrap">
          <div id="dvisite-share" class="fstpn-ui-dvisite-share"></div>
          <div id="dvisite-embed" class="jssocials-share jssocials-share-embed"><a href="#" class="jssocials-share-link"><i class="fa fa-code jssocials-share-logo"></i><span class="jssocials-share-label">Int&eacute;grer</span></a></div>
          <br/><input id="dvisite-embed-code" class="fstpn-ui-dvisite-embed-code" value="<iframe width='560' height='315' src='<?php echo current_url() ?>' allowfullscreen frameborder='0' scrolling='no'></iframe>">
        </div>
      </div>
    </div>
   
    <script src="<?php echo base_url() . 'assets/js/lib/jquery.min.js'; ?>"></script>
    <script src="<?php echo base_url() . 'assets/js/view.js'; ?>"></script>
    <script src="<?php echo base_url() . 'lib/tooltipster/js/tooltipster.bundle.min.js'; ?>"></script>
    <script src="<?php echo base_url() . 'lib/lightslider/lightslider.min.js'; ?>"></script>
    <script src="<?php echo base_url() . 'lib/jssocials/jssocials.min.js'; ?>"></script>
    <script src="<?php echo base_url() . 'lib/idvisite/three.min.js'; ?>"></script>
    <script src="<?php echo base_url() . 'lib/idvisite/jquery.idvisite.js'; ?>"></script>

    <script type="text/javascript">
	jQuery( document ).ready(function( jQuery ) {
		jQuery('#dvisite').idvisite({
			theme: 'ipnrm-theme-visitepano',
			autoLoad: true,
			autoRotate: true,
			autoRotateSpeed: 0.001,
			showZoomCtrl:false ,
			showShareCtrl: true,
			showAutoRotateCtrl: true,
			pitchLimits: true,
			sceneId: 'scene0',
			scenes: {
					
  <?php foreach($scenes as $key => $scene) { ?>
  <?php echo 'scene' . $key; ?> : {
							type  : 'sphere',
							image : '
  <?php echo ($scene['image']['isCustom'] ? $scene['image']['url'] : $uploadUrl . $scene['image']['url']); ?>',
							title : '
  <?php echo ($scene['title']); ?>',
							yaw   : 
  <?php echo ($scene['yaw'] !== null ? $scene['yaw'] : 0); ?>,
							pitch : 
  <?php echo ($scene['pitch'] !== null ? $scene['pitch'] : 0); ?>,
							zoom  : 
  <?php echo ($scene['zoom'] !== null && $scene['zoom'] >= 0 && $scene['zoom'] <= 75 ? $scene['zoom'] :75); ?>
						},
					
  <?php } ?>
				},
				onSceneChange: function(oldSceneId, newSceneId) {
					jQuery('.fstpn-ui-dvisite-slider-thumb').removeClass('fstpn-ui-active');
					jQuery('.fstpn-ui-dvisite-slider-thumb[data-scene="' + newSceneId + '"]').addClass('fstpn-ui-active');
				},
				onShare: function(e) {
					jQuery("#dvisite-share-wrap").toggleClass('fstpn-ui-active');
				}
			});
			
			var $el = jQuery('#dvisite-slider-wrap').detach();
			jQuery('#dvisite .ipnrm-controls').append($el);
			
			jQuery('#dvisite-slider').lightSlider({
				autoWidth:true,
				loop:false,
				pager:false,
				gallery:true,
				onSliderLoad: function() {
					jQuery('.fstpn-ui-dvisite-slider-wrap').removeClass('fstpn-ui-hidden');
					jQuery('.fstpn-ui-dvisite-slider-toggle').removeClass('fstpn-ui-hidden');
				}
			});
			
			jQuery('.fstpn-ui-dvisite-slider-toggle').on('click', function() {
				var $sliderWrap = jQuery('.fstpn-ui-dvisite-slider-wrap');
				$sliderWrap.toggleClass('fstpn-ui-hidden');
			});
			
			jQuery('.fstpn-ui-dvisite-slider-thumb').on('click', function() {
				var sceneId = jQuery(this).data("scene");
				if (sceneId) {
					jQuery('#dvisite').idvisite("loadscene", {sceneId: sceneId});
				}
			});
			
			jQuery('.fstpn-ui-dvisite-slider-thumb').tooltipster({
				parent: '#dvisite .ipnrm-controls',
				theme: 'tooltipster-borderless',
				animation: 'grow'
			});
			
			var $el = jQuery('#dvisite-share-wrap').detach();
			jQuery('#dvisite .ipnrm-controls').append($el);
			
			$("#dvisite-share").jsSocials({
				text: 'Visite 360.',
				showLabel:true,
				showCount:true,
				shareIn:'popup',
				shares: ['email', 'twitter', 'facebook']
			});
			
			var $el = $("#dvisite-embed").detach();
			$el.on("click", function() {
				$("#dvisite-embed-code").toggleClass("fstpn-ui-active");
			});
			$("#dvisite-share .jssocials-shares").append($el);
		});
$(window).bind('mousewheel DOMMouseScroll', function(e)
{
    //ctrl key is pressed
    if(e.ctrlKey == true)
    {
        e.preventDefault();

        //Your logic here
        console.log("Zoom Feature Disabled. ctrl+Mousewheel Pressed");        
    }
});
	
    </script>
  </body>
</html>

1 个答案:

答案 0 :(得分:0)

尝试这样的事情:

$("body").on("mousewheel", function() { return false; });