主頁 > 企業開發 > 向下/向上拖動可拖動專案時頁面不會垂直滾動

向下/向上拖動可拖動專案時頁面不會垂直滾動

2022-10-09 14:54:03 企業開發

我有一個拖放測驗,用戶可以在其中單擊一個術語并將其拖動到陳述句串列中的正確空白處。

但是,當可拖動的術語和段落不在視口中并且您需要滾動時,這適用于較長的頁面,當您將術語拖動到頁面的底部邊緣時,頁面不會移動。我已經從父元素中洗掉了很多,overflow: hidden但是我仍然遇到這個問題。

任何人都可以解釋為什么并希望提供一個解決方案,以便在較短的視口上可以訪問內容,同時拖動?如果您使用箭頭鍵進行拖動,我注意到頁面確實會移動,所以我認為這不是overflow問題嗎?

添加了要發布的代碼,但如果更易于查看,也可以在 CodePen 上使用:https ://codepen.io/moy/pen/gOzWBmJ

/**
 * Fix for iOS bug with scroll height when using 100vh/fixed elements.
 */
 
const documentHeight = () => {
    const doc = document.documentElement
    doc.style.setProperty('--doc-height', '${window.innerHeight}px')
}
window.addEventListener('resize', documentHeight)
documentHeight()




/**
 * jQUery UI tabs
 */

$(function() {
    $('#tabs').tabs();
});




/*------------------------------------*\
    #QUIZZES
\*------------------------------------*/

/**
 * Drag & Drop Quiz.
 *
 * 1. Make words draggable with revert = true.
 */
 
$(document).ready(function() {
    score = 0;
    if ($('.draggable')[0]) {
        $('.draggable').draggable({
            revert: true /* [1] */,
            snapTolerance: 30,
            revertDuration: 0,
            cursor: 'move',
            create: function(event, ui) {
                $(event.target).css('width', Math.ceil($(event.target).width())   1   'px');
            },
            zIndex: 100,
        });
    }
});

/**
 * Make blank spaces accept corresponding word.
 */

$('.blank').each(function(index) {
    toAccept = $(this)[0].getAttribute('data-accept'); //Compatible for lower IE
    // Resize spans to correct answer
    if ($(this).hasClass('resizable')) {
        answer = $('.draggable.'   toAccept);
        width = answer[0].scrollWidth;
        width =
            width -
            $(this)
                .css('padding-left')
                .replace('px', '') *
                2;
        $(this).css('width', width);
    }

    $(this).droppable({
        accept: '.'   toAccept,
        drop: function(event, ui) {
            $(this).append(ui.draggable);
            $(this).addClass('answered');

            score  ;
            $(ui.draggable).draggable('destroy');
            $(this).droppable('destroy');
        },
    });
});

/**
 * Multiple Choice Quiz (radio button based).
 */

function checkMultiChoiceAnswer() {
    score = 0;
    qs = 0;
    $('input[value="true"]').each(function() {
        qs  ;
    });
    $('input').each(function(ind, ele, arr) {
        if (ele.value == 'true' && ele.checked === true) {
            score  ;
        }
    });
    // console.log(score);
    $('.quiz__correct').text(score.toString());
    $('.quiz__total').text(qs.toString());
}

function multiReset() {
    qs = 0;
    $('.checked').each(function(ind, ele, arr) {
        $(ele).removeClass('checked');
    });
    $('input').each(function(ind, ele, arr) {
        ele.checked = false;
    });
    $('input[value="true"]').each(function() {
        qs  ;
    });
    $('.quiz__total').text(qs);
    $('.quiz__correct').text('0');
}

/**
 * Data Entry Quiz (input based).
 */

function checkAnswersCashFlow() {
    score = 0;
    $('.answerable').each(function(index, element, array) {
        givenAns = $(element)[0].value.replace('/[^0-9]/g', '');
        givenAns = givenAns.toLowerCase();

        ans = $(element)[0]
            .getAttribute('data-accept')
            .replace('/[^0-9]/g', '');
        if (givenAns == ans) {
            score  ;
        }
        $('.quiz__correct').text(score);
    });
}

function tableReset() {
    $('.quiz__correct').text('0');
    $('.answerable').val('');
}

/**
 * Sets Quiz score to 0/X on page load and on reset. This works on the "Multiple
 * Choice Quiz" and also the "Data Entry Quiz".
 */

window.onload = function() {
    if (typeof $('.quiz__total')[0] != 'undefined') {
        qs = 0;
        $('input[value="true"]').each(function() {
            qs  ;
        });
        $('.quiz__total').text(qs);
    }
    if (typeof $('.answerable')[0] != 'undefined') {
        total = 0;
        $('.answerable').each(function(ind, ele, arr) {
            total  ;
        });
        $('.quiz__total').text(total);
    }
};
/* Base */
html {
  background: white;
  font-size: 62.5%;
  height: 100%;
  height: var(--doc-height);
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: #f7f7f7;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  background: skyblue;
  color: black;
  font-family: Arial;
  font-size: 16px;
  font-size: 1.6rem;
  font-weight: 400;
  min-height: 100%;
  min-height: var(--doc-height);
  letter-spacing: 1px;
  line-height: 1.6em;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0 0 24px;
  padding: 0;
}

/* Page Layout */
.page {
  padding: 72px 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.page-head {
  background-color: white;
  box-shadow: inset 0 -4px 0 #f7f7f7, 0 4px 0 rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  display: flex;
  height: 72px;
  padding: 0 12px;
  position: fixed;
  top: 0;
  text-align: center;
  width: 100%;
  z-index: 100;
}

.page-foot {
  background-color: white;
  box-sizing: border-box;
  box-shadow: inset 0 4px 0 #f7f7f7, 0 -4px 0 rgba(0, 0, 0, 0.08);
  height: 72px;
  padding: 12px;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
}

/* Main Container */
.main {
  display: flex;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 24px 0 0;
  position: relative;
  width: 100%;
  max-width: 1024px;
  z-index: 10;
}
.main:before, .main:after {
  content: "";
  display: flex;
  flex-shrink: 0;
  position: sticky;
  background: red;
  background-size: 100%;
  height: 370px;
  top: 64px;
  margin-left: -112px;
  width: 112px;
}
.main:after {
  margin-left: auto;
  margin-right: -112px;
}

.main__inner {
  box-sizing: border-box;
  display: block;
  padding: 0 12px;
  width: 100%;
}

/* Content Group */
.wrap {
  background: white;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.08), 4px 4px 0 rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  border-radius: 12px;
  margin: 0 auto 24px;
  padding: 24px 24px 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* Boxout */
.boxout {
  background-color: #f7f7f7;
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 24px 24px 0;
  position: relative;
}

/* Quiz */
.missing-words {
  position: relative;
}

.missing-words__answers {
  background: white;
  border-radius: 4px;
  margin-bottom: 24px;
  padding: 24px 24px 12px;
  transform: translateZ(0);
}

.missing-words__answers-item {
  background: none;
  box-sizing: border-box;
  display: inline-block;
  min-height: 32px;
  margin: 0 4px 8px 0;
  padding: 0;
  transition: 0.24s ease-in;
  vertical-align: top;
}

.missing-words__draggable {
  background: skyblue;
  border-radius: 24px;
  color: black;
  cursor: -webkit-grab;
  cursor: grab;
  display: block;
  font-size: 14px;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 16px;
  padding: 8px 16px;
  position: relative;
  white-space: nowrap;
}

.missing-word__list {
  border-radius: 4px;
  overflow: hidden;
  padding-left: 0;
}

.missing-words__list li {
  background: white;
  margin-bottom: 2px;
  padding: 24px 24px 15px;
}

.missing-words__blank {
  background: #f7f7f7;
  outline: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: 24px;
  box-shadow: inset 2px 2px 0 #f7f7f7;
  box-sizing: border-box;
  display: inline-block;
  min-height: 32px;
  letter-spacing: 1px;
  margin: 8px 2px !important;
  text-align: center;
  vertical-align: middle;
  width: calc(100% - 4px);
}

/* Table */
.table-overflow {
  overflow-x: auto;
}

table {
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 14px;
  font-size: 1.4rem;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

tbody th,
tbody td {
  background: #f7f7f7;
}

/* Tabs */
.ui-tabs {
  margin: 0 0var --spacing-24;
  position: relative;
  text-shadow: none;
  width: 100%;
  overflow: hidden;
}

.ui-tabs-nav {
  font-weight: 700;
  display: block;
  margin: 0;
  padding: 0;
  position: relative;
  width: 100%;
  white-space: nowrap;
  overflow-x: auto;
}

.ui-tabs-nav li {
  background: none;
  display: inline-block;
  margin: 0;
  padding-left: 0;
  position: relative;
  width: auto;
}

.ui-tabs-nav a {
  background: skyblue;
  box-sizing: border-box;
  border-radius: 8px 8px 0 0;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-size: 1.4rem;
  height: 48px;
  line-height: 48px;
  outline: none;
  padding: 0 12px;
  transition: none;
  min-width: 48px;
}

.ui-tabs-nav .ui-state-active a {
  background: #f7f7f7;
}

.ui-tabs-panel {
  background: #f7f7f7;
  border-radius: 0 0 12px 12px;
  clear: both;
  display: block;
  margin: 0 0 24px;
  padding: 24px 24px 0;
  position: relative;
}
<div class="page">
  <div class="page-head">Fixed Header</div>
  <div class="main">
    <div class="main__inner">
      <div class="wrap">

        <div class="boxout">
            <h2>Quiz</h2>
          <p>Drag the correct words from the list below to complete the following sentences:</p>
          <div class="missing-words">
            <ul class="missing-words__answers">
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-1">Closed</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-2">Characteristics</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-3">Loyalty</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-4">Observations</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-5">Sales</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-6">Primary</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-7">Profiles</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-8">Competitors</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-9">Quantitative</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-10">Same</span></li>
            </ul>
            <ul class="missing-words__list">
              <li>In order to understand target customers, a business may create customer <span class="missing-words__blank blank resizable" data-accept="word-7"></span> – this involves grouping customers together based on sets of shared <span class="missing-words__blank blank resizable" data-accept="word-2"></span> .</li>
              <li>Identifying and marketing to target customers is the most effective way for a business to maximise <span class="missing-words__blank blank resizable" data-accept="word-5"></span> . Targeting customers effectively also helps a business to build customer <span class="missing-words__blank blank resizable" data-accept="word-3"></span> .</li>
              <li><span class="missing-words__blank blank resizable" data-accept="word-8"></span> are other businesses that offer the <span class="missing-words__blank blank resizable" data-accept="word-10"></span> or similar products/services.</li>
              <li>Questionnaires, focus groups and <span class="missing-words__blank blank resizable" data-accept="word-4"></span> are all examples of <span class="missing-words__blank blank resizable" data-accept="word-6"></span> research methods.</li>
              <li><span class="missing-words__blank blank resizable" data-accept="word-9"></span> data relates to amounts or quantities and can be easily counted and measured. It can be collected through the use of <span class="missing-words__blank blank resizable" data-accept="word-1"></span> questions.</li>
            </ul>
          </div>
        </div>

        <div class="table-overflow">
          <table class="table-solid">
            <thead>
              <tr>
                <th style="width: 33.33333%;">&nbsp;</th>
                <th style="width: 33.33333%;">Primary research</th>
                <th style="width: 33.33333%;">Secondary research</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <th>Definition:</th>
                <td><textarea></textarea></td>
                <td><textarea></textarea></td>
              </tr>
              <tr>
                <th>Examples:</th>
                <td><textarea></textarea></td>
                <td><textarea></textarea></td>
              </tr>
            </tbody>
          </table>
          <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
              <li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" role="tab" tabindex="0" aria-controls="tab-1" aria-labelledby="ui-id-1" aria-selected="true" aria-expanded="true"><a href="#tab-1" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">Ikea</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-2" aria-labelledby="ui-id-2" aria-selected="false" aria-expanded="false"><a href="#tab-2" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">Nike</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-3" aria-labelledby="ui-id-3" aria-selected="false" aria-expanded="false"><a href="#tab-3" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">Microsoft</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-4" aria-labelledby="ui-id-4" aria-selected="false" aria-expanded="false"><a href="#tab-4" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-4">Tesla</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-5" aria-labelledby="ui-id-5" aria-selected="false" aria-expanded="false"><a href="#tab-5" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-5">Starbucks</a></li>
            </ul>
            <div id="tab-1" aria-labelledby="ui-id-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="false">
              <h2>Ikea</h2>
              <p>Ikea’s mission statement is:</p>
              <blockquote>
                <p>To offer a wide range of well-designed, functional home furnishing products at prices so low, that as many people as possible will be able to afford them.</p>
              </blockquote>
            </div>
            <div id="tab-2" aria-labelledby="ui-id-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Nike</h2>
              <p>Nike’s mission statement is:</p>
              <blockquote>
                <p>To bring inspiration and innovation to every athlete in the world – if you have a body, you are an athlete.</p>
              </blockquote>
            </div>
            <div id="tab-3" aria-labelledby="ui-id-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Microsoft</h2>
              <p>Microsoft’s mission statement is:</p>
              <blockquote>
                <p>To empower every person and every organisation on the planet to achieve more.</p>
              </blockquote>
            </div>
            <div id="tab-4" aria-labelledby="ui-id-4" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Tesla</h2>
              <p>Tesla’s mission statement is:</p>
              <blockquote>
                <p>To accelerate the world’s transition to sustainable energy.</p>
              </blockquote>
            </div>
            <div id="tab-5" aria-labelledby="ui-id-5" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Starbucks</h2>
              <p>Starbucks’ mission statement is:</p>
              <blockquote>
                <p>To inspire and nurture the human spirit – one person, one cup and one neighbourhood at a time.</p>
              </blockquote>
            </div>
          </div>

        </div>
      </div>
    </div>
  </div>
  <div class="page-foot">Fixed Footer</div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js">
</script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>

uj5u.com熱心網友回復:

您將需要使用helperappendTo選項。這將在此處進行更多討論。

這是一個例子。

/**
 * Fix for iOS bug with scroll height when using 100vh/fixed elements.
 */

const documentHeight = () => {
  const doc = document.documentElement
  doc.style.setProperty('--doc-height', '${window.innerHeight}px')
}
window.addEventListener('resize', documentHeight);
documentHeight();


$(function() {
  $('#tabs').tabs();

  var score = 0;
  if ($('.draggable').length) {
    $('.draggable').draggable({
      containment: ".wrap",
      appendTo: ".wrap",
      helper: "clone",
      revert: true,
      snapTolerance: 30,
      revertDuration: 0,
      cursor: 'move',
      create: function(event, ui) {
        $(event.target).css('width', Math.ceil($(event.target).width())   1   'px');
      },
      start: function(e, ui) {
        $(this).css("visibility", "hidden");
      },
      stop: function(e, ui) {
        $(this).css("visibility", "visible");
      },
      zIndex: 1000
    });
  }

  $('.blank').each(function(index) {
    toAccept = $(this)[0].getAttribute('data-accept'); //Compatible for lower IE
    // Resize spans to correct answer
    if ($(this).hasClass('resizable')) {
      answer = $('.draggable.'   toAccept);
      width = answer[0].scrollWidth;
      width =
        width -
        $(this)
        .css('padding-left')
        .replace('px', '') *
        2;
      $(this).css('width', width);
    }

    $(this).droppable({
      accept: '.'   toAccept,
      drop: function(event, ui) {
        $(this).append(ui.draggable);
        ui.draggable.css("visibility", "visible");
        $(this).addClass('answered');
        score  ;
        $(ui.draggable).draggable('destroy');
        $(this).droppable('destroy');
      },
    });
  });

  function checkMultiChoiceAnswer() {
    score = 0;
    qs = 0;
    $('input[value="true"]').each(function() {
      qs  ;
    });
    $('input').each(function(ind, ele, arr) {
      if (ele.value == 'true' && ele.checked === true) {
        score  ;
      }
    });
    // console.log(score);
    $('.quiz__correct').text(score.toString());
    $('.quiz__total').text(qs.toString());
  }

  function multiReset() {
    qs = 0;
    $('.checked').each(function(ind, ele, arr) {
      $(ele).removeClass('checked');
    });
    $('input').each(function(ind, ele, arr) {
      ele.checked = false;
    });
    $('input[value="true"]').each(function() {
      qs  ;
    });
    $('.quiz__total').text(qs);
    $('.quiz__correct').text('0');
  }

  /**
   * Data Entry Quiz (input based).
   */

  function checkAnswersCashFlow() {
    score = 0;
    $('.answerable').each(function(index, element, array) {
      givenAns = $(element)[0].value.replace('/[^0-9]/g', '');
      givenAns = givenAns.toLowerCase();

      ans = $(element)[0]
        .getAttribute('data-accept')
        .replace('/[^0-9]/g', '');
      if (givenAns == ans) {
        score  ;
      }
      $('.quiz__correct').text(score);
    });
  }

  function tableReset() {
    $('.quiz__correct').text('0');
    $('.answerable').val('');
  }

  /**
   * Sets Quiz score to 0/X on page load and on reset. This works on the "Multiple
   * Choice Quiz" and also the "Data Entry Quiz".
   */

  window.onload = function() {
    if (typeof $('.quiz__total')[0] != 'undefined') {
      qs = 0;
      $('input[value="true"]').each(function() {
        qs  ;
      });
      $('.quiz__total').text(qs);
    }
    if (typeof $('.answerable')[0] != 'undefined') {
      total = 0;
      $('.answerable').each(function(ind, ele, arr) {
        total  ;
      });
      $('.quiz__total').text(total);
    }
  };
});
/* Base */

html {
  background: white;
  font-size: 62.5%;
  height: 100%;
  height: var(--doc-height);
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: #f7f7f7;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

body {
  background: skyblue;
  color: black;
  font-family: Arial;
  font-size: 16px;
  font-size: 1.6rem;
  font-weight: 400;
  min-height: 100%;
  min-height: var(--doc-height);
  letter-spacing: 1px;
  line-height: 1.6em;
  margin: 0 auto;
  padding: 0;
  width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0 0 24px;
  padding: 0;
}


/* Page Layout */

.page {
  padding: 72px 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.page-head {
  background-color: white;
  box-shadow: inset 0 -4px 0 #f7f7f7, 0 4px 0 rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  display: flex;
  height: 72px;
  padding: 0 12px;
  position: fixed;
  top: 0;
  text-align: center;
  width: 100%;
  z-index: 100;
}

.page-foot {
  background-color: white;
  box-sizing: border-box;
  box-shadow: inset 0 4px 0 #f7f7f7, 0 -4px 0 rgba(0, 0, 0, 0.08);
  height: 72px;
  padding: 12px;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
}


/* Main Container */

.main {
  display: flex;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 24px 0 0;
  position: relative;
  width: 100%;
  max-width: 1024px;
  z-index: 10;
}

.main:before,
.main:after {
  content: "";
  display: flex;
  flex-shrink: 0;
  position: sticky;
  background: red;
  background-size: 100%;
  height: 370px;
  top: 64px;
  margin-left: -112px;
  width: 112px;
}

.main:after {
  margin-left: auto;
  margin-right: -112px;
}

.main__inner {
  box-sizing: border-box;
  display: block;
  padding: 0 12px;
  width: 100%;
}


/* Content Group */

.wrap {
  background: white;
  box-shadow: inset -4px -4px 0 rgba(0, 0, 0, 0.08), 4px 4px 0 rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
  border-radius: 12px;
  margin: 0 auto 24px;
  padding: 24px 24px 0;
  position: relative;
  overflow: hidden;
  width: 100%;
}


/* Boxout */

.boxout {
  background-color: #f7f7f7;
  border-radius: 12px;
  margin-bottom: 24px;
  padding: 24px 24px 0;
  position: relative;
}


/* Quiz */

.missing-words {
  position: relative;
}

.missing-words__answers {
  background: white;
  border-radius: 4px;
  margin-bottom: 24px;
  padding: 24px 24px 12px;
  transform: translateZ(0);
}

.missing-words__answers-item {
  background: none;
  box-sizing: border-box;
  display: inline-block;
  min-height: 32px;
  margin: 0 4px 8px 0;
  padding: 0;
  transition: 0.24s ease-in;
  vertical-align: top;
}

.missing-words__draggable {
  background: skyblue;
  border-radius: 24px;
  color: black;
  cursor: -webkit-grab;
  cursor: grab;
  display: block;
  font-size: 14px;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 1px;
  line-height: 16px;
  padding: 8px 16px;
  position: relative;
  white-space: nowrap;
}

.missing-word__list {
  border-radius: 4px;
  overflow: hidden;
  padding-left: 0;
}

.missing-words__list li {
  background: white;
  margin-bottom: 2px;
  padding: 24px 24px 15px;
}

.missing-words__blank {
  background: #f7f7f7;
  outline: 2px dashed rgba(0, 0, 0, 0.12);
  border-radius: 24px;
  box-shadow: inset 2px 2px 0 #f7f7f7;
  box-sizing: border-box;
  display: inline-block;
  min-height: 32px;
  letter-spacing: 1px;
  margin: 8px 2px !important;
  text-align: center;
  vertical-align: middle;
  width: calc(100% - 4px);
}


/* Table */

.table-overflow {
  overflow-x: auto;
}

table {
  border-collapse: separate;
  border-spacing: 2px;
  font-size: 14px;
  font-size: 1.4rem;
  margin-bottom: 24px;
  width: 100%;
  max-width: 100%;
}

th,
td {
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

tbody th,
tbody td {
  background: #f7f7f7;
}


/* Tabs */

.ui-tabs {
  margin: 0 0var --spacing-24;
  position: relative;
  text-shadow: none;
  width: 100%;
  overflow: hidden;
}

.ui-tabs-nav {
  font-weight: 700;
  display: block;
  margin: 0;
  padding: 0;
  position: relative;
  width: 100%;
  white-space: nowrap;
  overflow-x: auto;
}

.ui-tabs-nav li {
  background: none;
  display: inline-block;
  margin: 0;
  padding-left: 0;
  position: relative;
  width: auto;
}

.ui-tabs-nav a {
  background: skyblue;
  box-sizing: border-box;
  border-radius: 8px 8px 0 0;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-size: 1.4rem;
  height: 48px;
  line-height: 48px;
  outline: none;
  padding: 0 12px;
  transition: none;
  min-width: 48px;
}

.ui-tabs-nav .ui-state-active a {
  background: #f7f7f7;
}

.ui-tabs-panel {
  background: #f7f7f7;
  border-radius: 0 0 12px 12px;
  clear: both;
  display: block;
  margin: 0 0 24px;
  padding: 24px 24px 0;
  position: relative;
}
<div class="page">
  <div class="page-head">Fixed Header</div>
  <div class="main">
    <div class="main__inner">
      <div class="wrap">
        <div class="boxout">
          <h2>Quiz</h2>
          <p>Drag the correct words from the list below to complete the following sentences:</p>
          <div class="missing-words">
            <ul class="missing-words__answers">
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-1">Closed</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-2">Characteristics</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-3">Loyalty</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-4">Observations</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-5">Sales</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-6">Primary</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-7">Profiles</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-8">Competitors</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-9">Quantitative</span></li>
              <li class="missing-words__answers-item"><span class="missing-words__draggable draggable word-10">Same</span></li>
            </ul>
            <ul class="missing-words__list">
              <li>In order to understand target customers, a business may create customer <span class="missing-words__blank blank resizable" data-accept="word-7"></span> – this involves grouping customers together based on sets of shared <span class="missing-words__blank blank resizable"
                  data-accept="word-2"></span> .</li>
              <li>Identifying and marketing to target customers is the most effective way for a business to maximise <span class="missing-words__blank blank resizable" data-accept="word-5"></span> . Targeting customers effectively also helps a business to
                build customer <span class="missing-words__blank blank resizable" data-accept="word-3"></span> .</li>
              <li><span class="missing-words__blank blank resizable" data-accept="word-8"></span> are other businesses that offer the <span class="missing-words__blank blank resizable" data-accept="word-10"></span> or similar products/services.</li>
              <li>Questionnaires, focus groups and <span class="missing-words__blank blank resizable" data-accept="word-4"></span> are all examples of <span class="missing-words__blank blank resizable" data-accept="word-6"></span> research methods.</li>
              <li><span class="missing-words__blank blank resizable" data-accept="word-9"></span> data relates to amounts or quantities and can be easily counted and measured. It can be collected through the use of <span class="missing-words__blank blank resizable"
                  data-accept="word-1"></span> questions.</li>
            </ul>
          </div>
        </div>
        <div class="table-overflow">
          <table class="table-solid">
            <thead>
              <tr>
                <th style="width: 33.33333%;">&nbsp;</th>
                <th style="width: 33.33333%;">Primary research</th>
                <th style="width: 33.33333%;">Secondary research</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <th>Definition:</th>
                <td><textarea></textarea></td>
                <td><textarea></textarea></td>
              </tr>
              <tr>
                <th>Examples:</th>
                <td><textarea></textarea></td>
                <td><textarea></textarea></td>
              </tr>
            </tbody>
          </table>
          <div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" role="tablist">
              <li class="ui-state-default ui-corner-top ui-tabs-active ui-state-active" role="tab" tabindex="0" aria-controls="tab-1" aria-labelledby="ui-id-1" aria-selected="true" aria-expanded="true"><a href="#tab-1" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-1">Ikea</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-2" aria-labelledby="ui-id-2" aria-selected="false" aria-expanded="false"><a href="#tab-2" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-2">Nike</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-3" aria-labelledby="ui-id-3" aria-selected="false" aria-expanded="false"><a href="#tab-3" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-3">Microsoft</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-4" aria-labelledby="ui-id-4" aria-selected="false" aria-expanded="false"><a href="#tab-4" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-4">Tesla</a></li>
              <li class="ui-state-default ui-corner-top" role="tab" tabindex="-1" aria-controls="tab-5" aria-labelledby="ui-id-5" aria-selected="false" aria-expanded="false"><a href="#tab-5" class="ui-tabs-anchor" role="presentation" tabindex="-1" id="ui-id-5">Starbucks</a></li>
            </ul>
            <div id="tab-1" aria-labelledby="ui-id-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="false">
              <h2>Ikea</h2>
              <p>Ikea’s mission statement is:</p>
              <blockquote>
                <p>To offer a wide range of well-designed, functional home furnishing products at prices so low, that as many people as possible will be able to afford them.</p>
              </blockquote>
            </div>
            <div id="tab-2" aria-labelledby="ui-id-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Nike</h2>
              <p>Nike’s mission statement is:</p>
              <blockquote>
                <p>To bring inspiration and innovation to every athlete in the world – if you have a body, you are an athlete.</p>
              </blockquote>
            </div>
            <div id="tab-3" aria-labelledby="ui-id-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Microsoft</h2>
              <p>Microsoft’s mission statement is:</p>
              <blockquote>
                <p>To empower every person and every organisation on the planet to achieve more.</p>
              </blockquote>
            </div>
            <div id="tab-4" aria-labelledby="ui-id-4" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Tesla</h2>
              <p>Tesla’s mission statement is:</p>
              <blockquote>
                <p>To accelerate the world’s transition to sustainable energy.</p>
              </blockquote>
            </div>
            <div id="tab-5" aria-labelledby="ui-id-5" class="ui-tabs-panel ui-widget-content ui-corner-bottom" role="tabpanel" aria-hidden="true" style="display: none;">
              <h2>Starbucks</h2>
              <p>Starbucks’ mission statement is:</p>
              <blockquote>
                <p>To inspire and nurture the human spirit – one person, one cup and one neighbourhood at a time.</p>
              </blockquote>
            </div>
          </div>

        </div>
      </div>
    </div>
  </div>
  <div class="page-foot">Fixed Footer</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.12.1/jquery.min.js">
</script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>

為了保留相同的 UI 互動,我們可以使原始的不可見 (visibility: hidden;如果用戶選擇了錯誤的答案,則保留適當的阻止和“還原”。

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/511221.html

標籤:javascripthtmljQuerycssjQuery-ui

上一篇:jquerysortable,connectWith,查找接收容器

下一篇:為什么ajax中的按鈕導致JQueryUI對話框在單擊時不會觸發?

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • IEEE1588PTP在數字化變電站時鐘同步方面的應用

    IEEE1588ptp在數字化變電站時鐘同步方面的應用 京準電子科技官微——ahjzsz 一、電力系統時間同步基本概況 隨著對IEC 61850標準研究的不斷深入,國內外學者提出基于IEC61850通信標準體系建設數字化變電站的發展思路。數字化變電站與常規變電站的顯著區別在于程序層傳統的電流/電壓互 ......

    uj5u.com 2020-09-10 03:51:52 more
  • HTTP request smuggling CL.TE

    CL.TE 簡介 前端通過Content-Length處理請求,通過反向代理或者負載均衡將請求轉發到后端,后端Transfer-Encoding優先級較高,以TE處理請求造成安全問題。 檢測 發送如下資料包 POST / HTTP/1.1 Host: ac391f7e1e9af821806e890 ......

    uj5u.com 2020-09-10 03:52:11 more
  • 網路滲透資料大全單——漏洞庫篇

    網路滲透資料大全單——漏洞庫篇漏洞庫 NVD ——美國國家漏洞庫 →http://nvd.nist.gov/。 CERT ——美國國家應急回應中心 →https://www.us-cert.gov/ OSVDB ——開源漏洞庫 →http://osvdb.org Bugtraq ——賽門鐵克 →ht ......

    uj5u.com 2020-09-10 03:52:15 more
  • 京準講述NTP時鐘服務器應用及原理

    京準講述NTP時鐘服務器應用及原理京準講述NTP時鐘服務器應用及原理 安徽京準電子科技官微——ahjzsz 北斗授時原理 授時是指接識訓通過某種方式獲得本地時間與北斗標準時間的鐘差,然后調整本地時鐘使時差控制在一定的精度范圍內。 衛星導航系統通常由三部分組成:導航授時衛星、地面檢測校正維護系統和用戶 ......

    uj5u.com 2020-09-10 03:52:25 more
  • 利用北斗衛星系統設計NTP網路時間服務器

    利用北斗衛星系統設計NTP網路時間服務器 利用北斗衛星系統設計NTP網路時間服務器 安徽京準電子科技官微——ahjzsz 概述 NTP網路時間服務器是一款支持NTP和SNTP網路時間同步協議,高精度、大容量、高品質的高科技時鐘產品。 NTP網路時間服務器設備采用冗余架構設計,高精度時鐘直接來源于北斗 ......

    uj5u.com 2020-09-10 03:52:35 more
  • 詳細解讀電力系統各種對時方式

    詳細解讀電力系統各種對時方式 詳細解讀電力系統各種對時方式 安徽京準電子科技官微——ahjzsz,更多資料請添加VX 衛星同步時鐘是我京準公司開發研制的應用衛星授時時技術的標準時間顯示和發送的裝置,該裝置以M國全球定位系統(GLOBAL POSITIONING SYSTEM,縮寫為GPS)或者我國北 ......

    uj5u.com 2020-09-10 03:52:45 more
  • 如何保證外包團隊接入企業內網安全

    不管企業規模的大小,只要企業想省錢,那么企業的某些服務就一定會采用外包的形式,然而看似美好又經濟的策略,其實也有不好的一面。下面我通過安全的角度來聊聊使用外包團的安全隱患問題。 先看看什么服務會使用外包的,最常見的就是話務/客服這種需要大量重復性、無技術性的服務,或者是一些銷售外包、特殊的職能外包等 ......

    uj5u.com 2020-09-10 03:52:57 more
  • PHP漏洞之【整型數字型SQL注入】

    0x01 什么是SQL注入 SQL是一種注入攻擊,通過前端帶入后端資料庫進行惡意的SQL陳述句查詢。 0x02 SQL整型注入原理 SQL注入一般發生在動態網站URL地址里,當然也會發生在其它地發,如登錄框等等也會存在注入,只要是和資料庫打交道的地方都有可能存在。 如這里http://192.168. ......

    uj5u.com 2020-09-10 03:55:40 more
  • [GXYCTF2019]禁止套娃

    git泄露獲取原始碼 使用GET傳參,引數為exp 經過三層過濾執行 第一層過濾偽協議,第二層過濾帶引數的函式,第三層過濾一些函式 preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'] (?R)參考當前正則運算式,相當于匹配函式里的引數 因此傳遞 ......

    uj5u.com 2020-09-10 03:56:07 more
  • 等保2.0實施流程

    流程 結論 ......

    uj5u.com 2020-09-10 03:56:16 more
最新发布
  • 使用Django Rest framework搭建Blog

    在前面的Blog例子中我們使用的是GraphQL, 雖然GraphQL的使用處于上升趨勢,但是Rest API還是使用的更廣泛一些. 所以還是決定回到傳統的rest api framework上來, Django rest framework的官網上給了一個很好用的QuickStart, 我參考Qu ......

    uj5u.com 2023-04-20 08:17:54 more
  • 記錄-new Date() 我忍你很久了!

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 大家平時在開發的時候有沒被new Date()折磨過?就是它的諸多怪異的設定讓你每每用的時候,都可能不小心踩坑。造成程式意外出錯,卻一下子找不到問題出處,那叫一個煩透了…… 下面,我就列舉它的“四宗罪”及應用思考 可惡的四宗罪 1. Sa ......

    uj5u.com 2023-04-20 08:17:47 more
  • 使用Vue.js實作文字跑馬燈效果

    實作文字跑馬燈效果,首先用到 substring()截取 和 setInterval計時器 clearInterval()清除計時器 效果如下: 實作代碼如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta ......

    uj5u.com 2023-04-20 08:12:31 more
  • JavaScript 運算子

    JavaScript 運算子/運算子 在 JavaScript 中,有一些運算子可以使代碼更簡潔、易讀和高效。以下是一些常見的運算子: 1、可選鏈運算子(optional chaining operator) ?.是可選鏈運算子(optional chaining operator)。?. 可選鏈操 ......

    uj5u.com 2023-04-20 08:02:25 more
  • CSS—相對單位rem

    一、概述 rem是一個相對長度單位,它的單位長度取決于根標簽html的字體尺寸。rem即root em的意思,中文翻譯為根em。瀏覽器的文本尺寸一般默認為16px,即默認情況下: 1rem = 16px rem布局原理:根據CSS媒體查詢功能,更改根標簽的字體尺寸,實作rem單位隨螢屏尺寸的變化,如 ......

    uj5u.com 2023-04-20 08:02:21 more
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 08:01:50 more
  • 如何在 vue3 中使用 jsx/tsx?

    我們都知道,通常情況下我們使用 vue 大多都是用的 SFC(Signle File Component)單檔案組件模式,即一個組件就是一個檔案,但其實 Vue 也是支持使用 JSX 來撰寫組件的。這里不討論 SFC 和 JSX 的好壞,這個仁者見仁智者見智。本篇文章旨在帶領大家快速了解和使用 Vu ......

    uj5u.com 2023-04-20 08:01:37 more
  • 【Vue2.x原始碼系列06】計算屬性computed原理

    本章目標:計算屬性是如何實作的?計算屬性快取原理以及洋蔥模型的應用?在初始化Vue實體時,我們會給每個計算屬性都創建一個對應watcher,我們稱之為計算屬性watcher ......

    uj5u.com 2023-04-20 08:01:31 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:01:10 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:00:32 more