主頁 > 資料庫 > 使用jQuery設定div填充等于元素的回應高度

使用jQuery設定div填充等于元素的回應高度

2022-04-26 02:48:44 資料庫

所以我有這個頁面,我設定了一個粘性導航欄,然后是下面的內容,有不同的部分。在每個部分的開頭,有一個 div 就像一個錨點,為此我有一個作業腳本,因此一旦單擊選單項之一,它就會滾動到該 div。

問題是:我需要錨 div 的 padding-bottom 的大小與選單的高度相同,這樣當用戶單擊選單項并滾動頁面時,它會到達相應部分的開頭。這不太好用,可能是因為我不是 jQuery 專家。

同樣,第二個技巧是,當頁面調整大小時,選單的高度會發生變化,因此我設定了一個事件偵聽器,以便將錨 div(.test class div)的 padding-bottom 設定為等于新的div的高度。這是包含以上所有內容的在線頁面的鏈接以及指向 codepen 的鏈接。謝謝!

http://canonseverywhere.net/test/test-mason/index.html

https://codepen.io/andra-vilcu/pen/mdpgBmY

/*my function for setting the padding-bottom for the scroll-to div class test the size of the height of the sticky navbar, so that it scrolls to it; and here is where the issue lies; this is ment for window resizing too, when the navbar fiv has a different height; and i want the .test div to have the padding-bottom equal to the size of that height, so that it shows the beginning of each sectionb on scroll;*/

/*var GetInnerHeight = $("div#navbar").innerHeight();*/
var GetInnerHeight = $(".grid").innerHeight();
$('.test').css("paddingBottom", GetInnerHeight);

$(document).ready(function() {
  $(window).resize(function() {


    var GetInnerHeight = $(".grid").innerHeight();
    $('.test').css("background-color", "pink");

  });
});

/*END*/

/*the isotop JS that works fine*/

// external js: isotope.pkgd.js


// init Isotope
var $grid = $('.grid').isotope({
  itemSelector: '.element-item',
  layoutMode: 'fitRows',
  getSortData: {
    name: '.name',
    symbol: '.symbol',
    number: '.number parseInt',
    category: '[data-category]',
    weight: function(itemElem) {
      var weight = $(itemElem).find('.weight').text();
      return parseFloat(weight.replace(/[\(\)]/g, ''));
    }
  }
});

// filter functions
var filterFns = {
  // show if number is greater than 50
  numberGreaterThan50: function() {
    var number = $(this).find('.number').text();
    return parseInt(number, 10) > 50;
  },
  // show if name ends with -ium
  ium: function() {
    var name = $(this).find('.name').text();
    return name.match(/ium$/);
  }
};

// bind filter button click
$('#filters').on('click', 'button', function() {
  var filterValue = $(this).attr('data-filter');
  // use filterFn if matches value
  filterValue = filterFns[filterValue] || filterValue;
  $grid.isotope({
    filter: filterValue
  });
});

// bind sort button click
$('#sorts').on('click', 'button', function() {
  var sortByValue = $(this).attr('data-sort-by');
  $grid.isotope({
    sortBy: sortByValue
  });
});

// change is-checked class on buttons
$('.button-group').each(function(i, buttonGroup) {
  var $buttonGroup = $(buttonGroup);
  $buttonGroup.on('click', 'button', function() {
    $buttonGroup.find('.is-checked').removeClass('is-checked');
    $(this).addClass('is-checked');
  });
});

/*end isotope js*/

/*beginning of scroll js script that works fine as well*/

function scrollFunction1() {
  let e = document.getElementById("test1");
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

function scrollFunction2() {
  let e = document.getElementById("test2");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

function scrollFunction3() {
  let e = document.getElementById("test3");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

function scrollFunction4() {
  let e = document.getElementById("test4");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

function scrollFunction5() {
  let e = document.getElementById("test5");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

function scrollFunction6() {
  let e = document.getElementById("test6");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}


function scrollFunction7() {
  let e = document.getElementById("test7");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}



function scrollFunction8() {
  let e = document.getElementById("test8");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}



function scrollFunction9() {
  let e = document.getElementById("test9");
  // This ends the block to the window 
  // bottom and also aligns the view to the center 
  e.scrollIntoView({
    block: 'start',
    behavior: 'smooth',
    inline: 'start'
  });
}

/*end of scroll script*/
* {
  box-sizing: border-box;
}

body {
  font-family: sans-serif;
}


/* ---- button ---- */

.button {
  display: inline-block;
  padding: 0.5em 1.0em;
  background: #EEE;
  border: none;
  border-radius: 7px;
  background-image: linear-gradient( to bottom, hsla(0, 0%, 0%, 0), hsla(0, 0%, 0%, 0.2));
  color: #222;
  font-family: sans-serif;
  font-size: 16px;
  text-shadow: 0 1px white;
  cursor: pointer;
}

.button:hover {
  background-color: #8CF;
  text-shadow: 0 1px hsla(0, 0%, 100%, 0.5);
  color: #222;
}

.button:active,
.button.is-checked {
  background-color: #28F;
}

.button.is-checked {
  color: white;
  text-shadow: 0 -1px hsla(0, 0%, 0%, 0.8);
}

.button:active {
  box-shadow: inset 0 1px 10px hsla(0, 0%, 0%, 0.8);
}


/* ---- button-group ---- */

.button-group {
  margin-bottom: 7px;
}

.button-group:after {
  content: '';
  display: block;
  clear: both;
}

.button-group .button {
  float: left;
  border-radius: 0;
  margin-left: 0;
  margin-right: 1px;
}

.button-group .button:first-child {
  border-radius: 0.5em 0 0 0.5em;
}

.button-group .button:last-child {
  border-radius: 0 0.5em 0.5em 0;
}


/* ---- isotope ---- */

.grid {
  /*border: 1px solid #333;*/
}


/* clear fix */

.grid:after {
  content: '';
  display: block;
  clear: both;
}


/* ---- .element-item ---- */


/*dimensiunea fiecarui element*/

.element-item {
  position: relative;
  float: left;
  /*width: 75px;*/
  width: auto;
  min-width: 115px;
  height: 37px;
  margin: 3px;
  padding: 6px;
  background: #888;
  color: #262524;
  border: 0.5px solid #333;
}

.element-item>* {
  margin: 0;
  padding: 0;
}

.element-item .name {
  position: absolute;
  left: 10px;
  top: 60px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: normal;
}

.element-item .symbol {
  position: absolute;
  left: 10px;
  top: 0px;
  font-size: 14px;
  font-weight: bold;
  color: white;
  width: auto;
}

.element-item .number {
  position: absolute;
  right: 8px;
  top: 5px;
}

.element-item .weight {
  position: absolute;
  left: 10px;
  top: 76px;
  font-size: 12px;
}

.element-item.alkali {
  background: #F00;
  background: hsl( 0, 100%, 50%);
}

.element-item.alkaline-earth {
  background: #F80;
  background: hsl( 36, 100%, 50%);
}

.element-item.lanthanoid {
  background: #FF0;
  background: hsl( 72, 100%, 50%);
}

.element-item.actinoid {
  background: #0F0;
  background: hsl( 108, 100%, 50%);
}

.element-item.transition {
  background: #0F8;
  background: hsl( 144, 100%, 50%);
}

.element-item.post-transition {
  background: #0FF;
  background: hsl( 180, 100%, 50%);
}

.element-item.metalloid {
  background: #08F;
  background: hsl( 216, 100%, 50%);
}

.element-item.diatomic {
  background: #00F;
  background: hsl( 252, 100%, 50%);
}

.element-item.halogen {
  background: #F0F;
  background: hsl( 288, 100%, 50%);
}

.element-item.noble-gas {
  background: #F08;
  background: hsl( 324, 100%, 50%);
}


/*pana aici tine stylesul ptr izotop; de aici incepe stylesul ptr scrooll*/

.outer-wrapper {
  margin: 0 auto;
  width: 100%;
}

.outer-wrapper div {
  margin: 0 auto;
  width: 100%;
}

#element {
  display: block;
  height: auto;
  width: auto;
  overflow: auto;
  margin: 10px auto 5px;
}

#el1 {
  display: block;
  height: auto;
  width: 1000px;
}

#el1 div {
  display: block;
  height: auto;
  width: 1000px;
}

#el1 p {
  text-align: justify;
}

#el2 {
  display: block;
  height: auto;
  width: 1000px;
}

#el2 div {
  display: block;
  height: auto;
  width: 1000px;
}

#el2 p {
  text-align: justify;
}


/* sticky menu css */


/* Style the navbar */

#navbar {
  overflow: auto;
  background-color: blue;
  /*era #333*/
  height: auto;
  position: fixed;
  width: 100%;
}

.test {
  padding-top: 0;
  margin-top: 0;
}

.test div {
  padding-top: 0;
  margin-top: 0;
}
<div id="navbar">
  <div class="grid" style=" width:69%; margin:0 auto !important; text-align:center;">
    <!-- de documentat -->
    <div onclick="scrollFunction1()" class="element-item transition metal " data-category="transition">

      <p class="symbol">Poetry</p>
      <!-- <p >80</p>
                <p >200.59</p>-->
    </div>
    <div onclick="scrollFunction2()" class="element-item metalloid " data-category="metalloid">
      <!-- <h3 >Tellurium</h3>-->
      <p class="symbol">Literature</p>
      <!--<p >52</p>
                <p >127.6</p>-->
    </div>
    <div onclick="scrollFunction3()" class="element-item post-transition metal " data-category="post-transition">
      <!--<h3 >Bismuth</h3>-->
      <p class="symbol">Games</p>
      <!-- <p >83</p>
                <p >208.980</p>-->
    </div>
    <div onclick="scrollFunction4()" class="element-item post-transition metal " data-category="post-transition">
      <!-- <h3 >Lead</h3>-->
      <p class="symbol">Music of my youth</p>
      <!--  <p >82</p>
                <p >207.2</p>-->
    </div>
    <div onclick="scrollFunction5()" class="element-item transition metal " data-category="transition">
      <!--<h3 >Gold</h3>-->
      <p class="symbol">Minimalism</p>
      <!--  <p >79</p>
                <p >196.967</p>-->
    </div>
    <div onclick="scrollFunction6()" class="element-item alkali metal " data-category="alkali">
      <!-- <h3 >Potassium</h3>-->
      <p class="symbol">Jazz</p>
      <!--  <p >19</p>
                <p >39.0983</p>-->
    </div>
    <div onclick="scrollFunction7()" class="element-item alkali metal " data-category="alkali">
      <!--  <h3 >Sodium</h3>-->
      <p class="symbol">Contemporary music</p>
      <!--  <p >11</p>
                <p >22.99</p>-->
    </div>
    <div onclick="scrollFunction8()" class="element-item transition metal " data-category="transition">
      <!-- <h3 >Cadmium</h3>-->
      <p class="symbol">Competitions</p>
      <!--  <p >48</p>
                <p >112.411</p>-->
    </div>
    <div onclick="scrollFunction9()" class="element-item alkaline-earth metal " data-category="alkaline-earth">
      <!--<h3 >Calcium</h3>-->
      <p class="symbol">neighbors</p>
      <!--  <p >20</p>
                <p >40.078</p>-->
    </div>


  </div>



</div>
<!-- end sticky menu -->


<!-- begins the scrolling sections -->
<div class="outer-wrapper">


  <div id="element" class="inner-wrapper">
    <!-- clasa nealocat-->

    <div id="test1" class="test" style="border:3px solid yellow;"></div>
    <div id="el1">
      <h1> TESTING PROCESS SECTION 1</h1><br>
      <p>"On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that are bound to ensue;
        and equal blame belongs to those who fail in their duty through weakness of will, which is the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish. </p><br>
    </div>

    <div id="test2" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 2</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates. </p><br>
    </div>

    <div id="test3" class="test" style="border:3px solid pink;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 3</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus,
        ut aut </p><br>
    </div>


    <div id="test4" class="test" style="border:3px solid purple;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 4</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo </p><br>
    </div>


    <div id="test5" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 5</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis </p><br>
    </div>

    <div id="test6" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 6</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis </p><br>
    </div>


    <div id="test7" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 7</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis </p><br>
    </div>


    <div id="test8" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 8</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum
    </div>


    <div id="test9" class="test" style="border:3px solid red;"></div>
    <!-- scroll to style="padding-bottom:80px;" -->
    <div id="el2">
      <h1>SECTION 9</h1>
      <p>"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt
        mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas
        assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis </p><br>
    </div>

  </div>

</div>
<!-- end outer wrapper -->

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.js"></script>

uj5u.com熱心網友回復:

既然你提到你想要一些關于如何簡化一切的幫助,我做了一個小演示來展示我將如何做到這一點。免責宣告:我不知道同位素,所以你可能需要修改東西。

我得告訴你我還沒有測驗過它,但它應該可以作業并消除很多重復的代碼。:)

由于您有大量具有相同結構的 div,因此使用 js 創建它們比為每個手動撰寫 HTML 更簡單!

// you could dynamically create your elements in js, saves some headache
// when working with a lot of data.
// simply create an object with all the properties you need for your elements!

let obj1 = {
    className: 'metal',
    transition: True, // could use boolean if it can only be in or out of transition
    text: 'Games'
}

let obj2 = {
    className: 'metalloid',
    transition: False,
    text: 'Literature'
}

function createElementItem(myObj) {
    // myObj is sort of a "template" for the property we will pass to this function.
    // we will call the function below with our objects we just created

    // you can create DOM elements by using <>, just don't forget to close!
    // if you do not insert it somewhere, it won't show up though. See bottom.
    let elem = $(`<div />`); // create div element
    elem.addClass(myObj.className); // add the class name
    let transition_name = myObj.transition ? 'transition' : 'post-transition';
    // explanation: fancy ternary operator is fancy. 
    // the left part (myObj.transition) is a Boolean type. The '?' operator
    // checks if the statement is true. If true, it returns the next option
    // 'transition'. If false, it returns 'post-transition'.
    elem.addClass(transition_name); // here we add the transition name.
    elem.data('category', transition_name); // and also set data-transition to the same value.

    let symbol_elem = $('<p  />');
    symbol_elem.text(myObj.text); // give symbol element your text
    symbol_elem.appendTo(elem); // insert the symbol element in element div

    let grid_elem = $('div.grid'); // select your grid, where you append element-items
    elem.appendTo(grid_elem); // and finally append your whole element to the existing grid

    // now the fun part: event listeners.
    // since we are in the same function, it's easy to access each element!
    elem.on('click', (e) => {
        let elem = $(this); // in this case, $(this) refers to element that has been clicked
        // you could also use $(e.target) instead of $(this)
        console.log('they see me scrollin');
        elem.scrollIntoView({
            block: 'start',
            behavior: 'smooth',
            inline: 'start'
        });
    })
}

// here is where the magic happens.
// we invoke our function, passing the objects from the top as a param
// so the function can access the important stuff
// this spits out the object HTML, injects it into DOM and applies the event listener all-in-one
createElementItem(obj1);
createElementItem(obj2);

關于調整大小:

$(window).on('resize', (e) => {
    // do not start variable names with Uppercase letters, this is 
    // reserved for classes!
    let innerHeight = $(".grid").innerHeight();
    $('.test').css("padding-bottom", innerHeight); // this SHOULD work...
});

// i think you're having a problem with putting the resize event
// listener in document.ready, but not 100% sure, would have to test
// since document.ready only executes once

uj5u.com熱心網友回復:

好的,所以我得到了這個有效的代碼。這是滾動腳本

   $(function(){
      $('a[href^="#"]:not([href="#"])').click(function(){
        $("html, body").animate({
          scrollTop: $($(this).attr("href")).position().top 
        }, 500);
        return false;
      });
    });

然后我用它來測量參考位置與滾動位置的比較,我所有的參考都有“標簽”類

function lineMove(){
  $('.tab').each(function (){
    var scrollPos = $(document).scrollTop();
    var linkRef = $($(this).attr("href"));
    var refPos = linkRef.position().top;
    var refHeight = linkRef.height();
    if(refPos <= scrollPos && refPos   refHeight > scrollPos){
      $('.tab').removeClass("active-tab");
      $(this).addClass("active-tab");   
    };
  });
};

而且當然

$(document).ready(function(){
  //On document load:
    lineMove();
  //On window scroll or resize:
  $(window).on("scroll resize", lineMove);
});

我想提一下,這段代碼是我在互聯網上找到的另一個代碼的一部分,它不是我的創作。但是,我對其進行了調整以適應這種情況。

最終解決方案:然后我作業了一點,我得到了這個:

function paddingTop (){
    var divHeight = $("div#id").innerHeight(); 
    $("#testbeta").css("padding", divHeight); /
    
};

評論:jQuery 不錯!

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

標籤:javascript html jQuery css

上一篇:有沒有辦法用jQuery按鈕洗掉這個div?

下一篇:SequelizefindAlluserswithIdbutreturnusersfromdifferentcolumn

標籤雲
其他(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)

熱門瀏覽
  • GPU虛擬機創建時間深度優化

    **?桔妹導讀:**GPU虛擬機實體創建速度慢是公有云面臨的普遍問題,由于通常情況下創建虛擬機屬于低頻操作而未引起業界的重視,實際生產中還是存在對GPU實體創建時間有苛刻要求的業務場景。本文將介紹滴滴云在解決該問題時的思路、方法、并展示最終的優化成果。 從公有云服務商那里購買過虛擬主機的資深用戶,一 ......

    uj5u.com 2020-09-10 06:09:13 more
  • 可編程網卡芯片在滴滴云網路的應用實踐

    **?桔妹導讀:**隨著云規模不斷擴大以及業務層面對延遲、帶寬的要求越來越高,采用DPDK 加速網路報文處理的方式在橫向縱向擴展都出現了局限性。可編程芯片成為業界熱點。本文主要講述了可編程網卡芯片在滴滴云網路中的應用實踐,遇到的問題、帶來的收益以及開源社區貢獻。 #1. 資料中心面臨的問題 隨著滴滴 ......

    uj5u.com 2020-09-10 06:10:21 more
  • 滴滴資料通道服務演進之路

    **?桔妹導讀:**滴滴資料通道引擎承載著全公司的資料同步,為下游實時和離線場景提供了必不可少的源資料。隨著任務量的不斷增加,資料通道的整體架構也隨之發生改變。本文介紹了滴滴資料通道的發展歷程,遇到的問題以及今后的規劃。 #1. 背景 資料,對于任何一家互聯網公司來說都是非常重要的資產,公司的大資料 ......

    uj5u.com 2020-09-10 06:11:05 more
  • 滴滴AI Labs斬獲國際機器翻譯大賽中譯英方向世界第三

    **桔妹導讀:**深耕人工智能領域,致力于探索AI讓出行更美好的滴滴AI Labs再次斬獲國際大獎,這次獲獎的專案是什么呢?一起來看看詳細報道吧! 近日,由國際計算語言學協會ACL(The Association for Computational Linguistics)舉辦的世界最具影響力的機器 ......

    uj5u.com 2020-09-10 06:11:29 more
  • MPP (Massively Parallel Processing)大規模并行處理

    1、什么是mpp? MPP (Massively Parallel Processing),即大規模并行處理,在資料庫非共享集群中,每個節點都有獨立的磁盤存盤系統和記憶體系統,業務資料根據資料庫模型和應用特點劃分到各個節點上,每臺資料節點通過專用網路或者商業通用網路互相連接,彼此協同計算,作為整體提供 ......

    uj5u.com 2020-09-10 06:11:41 more
  • 滴滴資料倉庫指標體系建設實踐

    **桔妹導讀:**指標體系是什么?如何使用OSM模型和AARRR模型搭建指標體系?如何統一流程、規范化、工具化管理指標體系?本文會對建設的方法論結合滴滴資料指標體系建設實踐進行解答分析。 #1. 什么是指標體系 ##1.1 指標體系定義 指標體系是將零散單點的具有相互聯系的指標,系統化的組織起來,通 ......

    uj5u.com 2020-09-10 06:12:52 more
  • 單表千萬行資料庫 LIKE 搜索優化手記

    我們經常在資料庫中使用 LIKE 運算子來完成對資料的模糊搜索,LIKE 運算子用于在 WHERE 子句中搜索列中的指定模式。 如果需要查找客戶表中所有姓氏是“張”的資料,可以使用下面的 SQL 陳述句: SELECT * FROM Customer WHERE Name LIKE '張%' 如果需要 ......

    uj5u.com 2020-09-10 06:13:25 more
  • 滴滴Ceph分布式存盤系統優化之鎖優化

    **桔妹導讀:**Ceph是國際知名的開源分布式存盤系統,在工業界和學術界都有著重要的影響。Ceph的架構和演算法設計發表在國際系統領域頂級會議OSDI、SOSP、SC等上。Ceph社區得到Red Hat、SUSE、Intel等大公司的大力支持。Ceph是國際云計算領域應用最廣泛的開源分布式存盤系統, ......

    uj5u.com 2020-09-10 06:14:51 more
  • es~通過ElasticsearchTemplate進行聚合~嵌套聚合

    之前寫過《es~通過ElasticsearchTemplate進行聚合操作》的文章,這一次主要寫一個嵌套的聚合,例如先對sex集合,再對desc聚合,最后再對age求和,共三層嵌套。 Aggregations的部分特性類似于SQL語言中的group by,avg,sum等函式,Aggregation ......

    uj5u.com 2020-09-10 06:14:59 more
  • 爬蟲日志監控 -- Elastc Stack(ELK)部署

    傻瓜式部署,只需替換IP與用戶 導讀: 現ELK四大組件分別為:Elasticsearch(核心)、logstash(處理)、filebeat(采集)、kibana(可視化) 下載均在https://www.elastic.co/cn/downloads/下tar包,各組件版本最好一致,配合fdm會 ......

    uj5u.com 2020-09-10 06:15:05 more
最新发布
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:33:24 more
  • MySQL中binlog備份腳本分享

    關于MySQL的二進制日志(binlog),我們都知道二進制日志(binlog)非常重要,尤其當你需要point to point災難恢復的時侯,所以我們要對其進行備份。關于二進制日志(binlog)的備份,可以基于flush logs方式先切換binlog,然后拷貝&壓縮到到遠程服務器或本地服務器 ......

    uj5u.com 2023-04-20 08:28:06 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:27:27 more
  • 快取與資料庫雙寫一致性幾種策略分析

    本文將對幾種快取與資料庫保證資料一致性的使用方式進行分析。為保證高并發性能,以下分析場景不考慮執行的原子性及加鎖等強一致性要求的場景,僅追求最終一致性。 ......

    uj5u.com 2023-04-20 08:26:48 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:26:35 more
  • 云時代,MySQL到ClickHouse資料同步產品對比推薦

    ClickHouse 在執行分析查詢時的速度優勢很好的彌補了MySQL的不足,但是對于很多開發者和DBA來說,如何將MySQL穩定、高效、簡單的同步到 ClickHouse 卻很困難。本文對比了 NineData、MaterializeMySQL(ClickHouse自帶)、Bifrost 三款產品... ......

    uj5u.com 2023-04-20 08:26:29 more
  • sql陳述句優化

    問題查找及措施 問題查找 需要找到具體的代碼,對其進行一對一優化,而非一直把關注點放在服務器和sql平臺 降低簡化每個事務中處理的問題,盡量不要讓一個事務拖太長的時間 例如檔案上傳時,應將檔案上傳這一步放在事務外面 微軟建議 4.啟動sql定時執行計劃 怎么啟動sqlserver代理服務-百度經驗 ......

    uj5u.com 2023-04-20 08:25:13 more
  • Redis 報”OutOfDirectMemoryError“(堆外記憶體溢位)

    Redis 報錯“OutOfDirectMemoryError(堆外記憶體溢位) ”問題如下: 一、報錯資訊: 使用 Redis 的業務介面 ,產生 OutOfDirectMemoryError(堆外記憶體溢位),如圖: 格式化后的報錯資訊: { "timestamp": "2023-04-17 22: ......

    uj5u.com 2023-04-20 08:24:54 more
  • day02-2-商鋪查詢快取

    功能02-商鋪查詢快取 3.商鋪詳情快取查詢 3.1什么是快取? 快取就是資料交換的緩沖區(稱作Cache),是存盤資料的臨時地方,一般讀寫性能較高。 快取的作用: 降低后端負載 提高讀寫效率,降低回應時間 快取的成本: 資料一致性成本 代碼維護成本 運維成本 3.2需求說明 如下,當我們點擊商店詳 ......

    uj5u.com 2023-04-20 08:24:03 more
  • day02-短信登錄

    功能實作02 2.功能01-短信登錄 2.1基于Session實作登錄 2.1.1思路分析 2.1.2代碼實作 2.1.2.1發送短信驗證碼 發送短信驗證碼: 發送驗證碼的介面為:http://127.0.0.1:8080/api/user/code?phone=xxxxx<手機號> 請求方式:PO ......

    uj5u.com 2023-04-20 08:23:11 more