jQuery中的100个技巧

Web开发实战:100个网页设计与开发实例解析 固定布局是一种网页布局方式,它不随浏览器窗口大小的变化而变化。在这种布局中,网站元素的大小和位置是固定的,通常使用像素(px)作为单位。固定布局允许设计师精确控制页面的布局,确保在所有设备上呈现出相同的设计和布局效果。然而,这种布局方式在响应式设计日益流行的当下,已较少用于主网站设计,而更多地用于特定页面的特定内容。虽然Bootstrap提供的默认样式已经非常美观,但在实际开发中,根据项目的品牌和设计要求,我们需要自定义样式以适应不同场景。 阅读详情

1.当document文档就绪时执行JavaScript代码。

  我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行。

复制代码
        <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

        <script>

            // Different ways to achieve the Document Ready event

            // With jQuery
            $(document).ready(function(){ /* ... */});

            // Short jQuery
            $(function(){ /* ... */});

            // Without jQuery (doesn't work in older IE versions)
            document.addEventListener('DOMContentLoaded',function(){
                // Your code goes here
            });

            // The Trickshot (works everywhere):

            r(function(){
                alert('DOM Ready!');
            })

            function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}

        </script>

复制代码

 

 

2.使用route。

复制代码
        <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

        <script>

            var route = {
                _routes : {},    // The routes will be stored here

                add    : function(url, action){
                    this._routes[url] = action;
                },

                run : function(){
                    jQuery.each(this._routes, function(pattern){
                        if(location.href.match(pattern)){
                            // "this" points to the function to be executed
                            this();
                        }
                    });
                }
            }

            // Will execute only on this page:
            route.add('002.html', function(){
                alert('Hello there!')
            });

            route.add('products.html', function(){
                alert("this won't be executed :(")
            });

            // You can even use regex-es:
            route.add('.*.html', function(){
                alert('This is using a regex!')
            });

            route.run();

        </script>
复制代码

 

3.使用JavaScript中的AND技巧。

  使用&&操作符的特点是如果操作符左边的表达式是false,那么它就不会再判断操作符右边的表达式了。所以:

复制代码
// Instead of writing this:
if($('#elem').length){
    // do something
}

// You can write this:

$('#elem').length && log("doing something");
复制代码

 

4. is()方法比你想象的更为强大。

下面举几个例子,我们先写一个id为elem的div。js代码如下:

复制代码
// First, cache the element into a variable:
var elem = $('#elem');

// Is this a div?
elem.is('div') && log("it's a div");

// Does it have the bigbox class?
elem.is('.bigbox') && log("it has the bigbox class!");

// Is it visible? (we are hiding it in this example)
elem.is(':not(:visible)') && log("it is hidden!");

// Animating
elem.animate({'width':200},1);

// is it animated?
elem.is(':animated') && log("it is animated!");
复制代码

其中判断是否为动画我觉得非常不错。

 

5.判断你的网页一共有多少元素。

 通过使用$("*").length();方法可以判断网页的元素数量。

// How many elements does your page have?
log('This page has ' + $('*').length + ' elements!');

 

6.使用length()属性很笨重,下面我们使用exist()方法。

复制代码
/ Old way
log($('#elem').length == 1 ? "exists!" : "doesn't exist!");

// Trickshot:

jQuery.fn.exists = function(){ return this.length > 0; }

log($('#elem').exists() ? "exists!" : "doesn't exist!");
复制代码

 

7.jQuery方法$()实际上是拥有两个参数的,你知道第二个参数的作用吗?

复制代码
// Select an element. The second argument is context to limit the search
// You can use a selector, jQuery object or dom element

$('li','#firstList').each(function(){
    log($(this).html());
});

log('-----');

// Create an element. The second argument is an
// object with jQuery methods to be called

var div = $('<div>',{
    "class": "bigBlue",
    "css": {
        "background-color":"purple"
    },
    "width" : 20,
    "height": 20,
    "animate" : {   // You can use any jQuery method as a property!
        "width": 200,
        "height":50
    }
});

div.appendTo('#result');
复制代码

 

8.使用jQuery我们可以判断一个链接是否是外部的,并来添加一个icon在非外部链接中,且确定打开方式。

  这里用到了hostname属性。

复制代码
<ul id="links"> 
   <li><a href="007.html">The previous tip</a></li> 
   <li><a href="./009.html">The next tip</a></li>
   <li><a href="http://www.google.com/">Google</a></li> 
</ul>

// Loop through all the links
$('#links a').each(function(){

    if(this.hostname != location.hostname){
        // The link is external
        $(this).append('<img src="assets/img/external.png" />')
               .attr('target','_blank');
    }

});
复制代码

 

9.jQuery中的end()方法可以使你的jQuery链更加高效。

复制代码
<ul id="meals"> <li> <ul class="breakfast"> <li class="eggs">No</li> <li class="toast">No</li> <li class="juice">No</li> </ul> </li> </ul>
// Here is how it is used:

var breakfast = $('#meals .breakfast');

breakfast.find('.eggs').text('Yes')
                      .end() // back to breakfast
                      .find('.toast').text('Yes')
                      .end()
                      .find('.juice').toggleClass('juice coffee').text('Yes');

breakfast.find('li').each(function(){
    log(this.className + ': ' + this.textContent)
});
复制代码

 

10.也许你希望你的web 应用感觉更像原生的,那么你可以阻止contextmenu默认事件。

复制代码
        <script>
            // Prevent right clicking on this page
            $(function(){
                $(document).on("contextmenu",function(e){
                    e.preventDefault();
                });
            });
        </script>
复制代码

 

11.一些站点可能会使你的网页在一个bar下面,即我们所看到在下面的网页是iframe标签中的,我们可以这样解决。

复制代码
// Here is how it is used:

if(window != window.top){
    window.top.location = window.location;
}
else{
    alert('This page is not displayed in a frame. Open 011.html to see it in action.');
}
复制代码

 

 

12.你的内联样式表并不是被设置为不可改变的,如下:

// Make the stylesheet visible and editable
$('#regular-style-block').css({'display':'block', 'white-space':'pre'})
                         .attr('contentEditable',true);

这样即可改变内联样式了。

 

13.有时候我们不希望网页的某一部分内容被选择比如复制粘贴这种事情,我们可以这么做:

复制代码
<p class="descr">In certain situations you might want to prevent text on the page from being selectable. Try selecting this text and hit view source to see how it is done.</p>

     <script>
            // Prevent text from being selected
            $(function(){
                $('p.descr').attr('unselectable', 'on')
                           .css('user-select', 'none')
                           .on('selectstart', false);
          });
     </script>
复制代码

这样,内容就不能被选择啦。

 

14.从CDN中引入jQuery,这样的方法可以提高我们网站的性能,并且引入最新的版本也是一个不错的主意。

下面会介绍四种不同的方法。

复制代码
        <!-- Case 1 - requesting jQuery from the official CDN -->
        <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>

        <!-- Case 2 - requesting jQuery from Google's CDN (notice the protocol) -->
        <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> -->

        <!-- Case 3 - requesting the latest minor 1.8.x version (only cached for an hour) -->
        <!-- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10/jquery.min.js"></script> -->

        <!-- Case 4 - requesting the absolute latest jQuery version (use with caution) -->
        <!-- <script src="http://code.jquery.com/jquery.min.js"></script> -->
复制代码

 

 

15.保证最小的DOM操作。

  我们知道js操作DOM是非常浪费资源的,我们可以看看下面的例子。

复制代码
CODE
// Bad
//var elem = $('#elem');
//for(var i = 0; i < 100; i++){
//    elem.append('<li>element '+i+'</li>');
//}

// Good
var elem = $('#elem'),
    arr = [];

for(var i = 0; i < 100; i++){
    arr.push('<li>element '+i+'</li>');
}

elem.append(arr.join(''));
复制代码

 

 

16.更方便的分解URL。

也许你会使用正则表达式来解析URL,但这绝对不是一种好的方法,我们可以借用a标签来实现它。

复制代码
// You want to parse this address into parts:
var url = 'http://tutorialzine.com/books/jquery-trickshots?trick=12#comments';

// The trickshot:
var a = $('<a>',{ href: url });

log('Host name: ' + a.prop('hostname'));
log('Path: ' + a.prop('pathname'));
log('Query: ' + a.prop('search'));
log('Protocol: ' + a.prop('protocol'));
log('Hash: ' + a.prop('hash'));
复制代码

 

17.不要害怕使用vanilla.js。

  jQuery背负的太多,这便是原因,你可以用一般的js。

复制代码
// Print the IDs of all LI items
$('#colors li').each(function(){

    // Access the ID directly, instead
    // of using jQuery's $(this).attr('id')

    log(this.id);

});
复制代码

 

18.最优化你的选择器

复制代码
// Let's try some benchmarks!

var iterations = 10000, i;

timer('Fancy');

for(i=0; i < iterations; i++){
    // This falls back to a SLOW JavaScript dom traversal
    $('#peanutButter div:first');
}

timer_result('Fancy');


timer('Parent-child');

for(i=0; i < iterations; i++){
    // Better, but still slow
    $('#peanutButter div');
}

timer_result('Parent-child');


timer('Parent-child by class');

for(i=0; i < iterations; i++){
    // Some browsers are a bit faster on this one
    $('#peanutButter .jellyTime')
复制代码

 

 

19.缓存你的selector。

复制代码
// Bad:
// $('#pancakes li').eq(0).remove();
// $('#pancakes li').eq(1).remove();
// $('#pancakes li').eq(2).remove();

// Good:
var pancakes = $('#pancakes li');

pancakes.eq(0).remove();
pancakes.eq(1).remove();
pancakes.eq(2).remove();

// Alternatively:
// pancakes.eq(0).remove().end()
//           .eq(1).remove().end()
//           .eq(2).remove().end();
复制代码

 

20.对于重复的函数只定义一次

  如果你追求代码的更高性能,那么当你设置事件监听程序时必须小心,只定义一次函数然后把它的名字作为事件处理程序传递是不错的方法。

复制代码
$(document).ready(function(){
    function showMenu(){
        alert('Showing menu!');
        // Doing something complex here
    }

    $('#menuButton').click(showMenu);
    $('#menuLink').click(showMenu);

});
复制代码

 

21.像对待数组一样地对待jQuery对象

  由于jQuery对象有index值和长度,所以这意味着我们可以把对象当作普通的数组对待。这样也会有更好地性能。

复制代码
var arr = $('li'),
    iterations = 100000;

timer('Native Loop');

for(var z=0;z<iterations;z++){

    var length = arr.length;
    for(var i=0; i < length; i++){
      arr[i];
    }
}
timer_result('Native Loop');

timer('jQuery Each');

for(z=0;z<iterations;z++){

    arr.each(function(i, val) {
      this;
    });
}
timer_result('jQuery Each');
复制代码

 

 22.当做复杂的修改时要分离元素。

  修改一个dom元素要求网页重绘,这个代价是高昂的,所以如果你想要再提高性能,就可以尝试着当对一个元素进行大量修改时先从页面中分离这个元素,修改完之后再添加到页面。

复制代码
// Modifying in place
var elem = $('#elem');

timer('In place');

for(i=0; i &lt; iterations; i++){

    elem.width(Math.round(100*Math.random()));
    elem.height(Math.round(100*Math.random()));

}

timer_result('In place');

var parent = elem.parent();

// Detaching first
timer('Detached');

elem.detach();

for(i=0; i &lt; iterations; i++){

    elem.width(Math.round(100*Math.random()));
    elem.height(Math.round(100*Math.random()));

}

elem.appendTo(parent);

timer_result('Detached');
复制代码

 

 

23.不要一直等待load事件。

  我们已经习惯了把我们所有的代码都放在ready的事件处理程序中,但是,如果你的html页面很庞大,decument ready恐怕会被延迟了,所以对于一些我们不希望ready后才可以触发的事件可以放在html的head元素中。

复制代码
        <script>

            // jQuery is loaded at this point. We can use
            // event delegation right away to bind events
            // even before $(document).ready:

            $(document).on('click', '#clickMe', function(){
                alert('Hit view source and see how this is made');
            });

            $(document).ready(function(){

                // This is where you would usually bind event handlers,
                // but as we are using delegation, there is no need to.

                // $('#clickMe').click(function(){ alert('Hey!'); });
            });

            // Note: You should place your script tags at the bottom of the page.
            // I have included them in the head only to demonstrate that we can bind
            // events before document ready and before the elements are created.

        </script>
复制代码

 

24.当使用js给多个元素添加样式时更好的做法是创建一个style元素。

  我们之前提到过,操作dom是非常慢的,所以当添加多个元素的样式时创建一个style元素并添加到document中是更好的做法。

  

复制代码
<ul id="testList">
 <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li> <li>Item</li>
 </ul>

var style = $('<style>');

// Try commenting out this line, or change the color:
style.text('#testList li{ color:red;}');

// Placing it before the result section so it affects the elements
style.prependTo('#result');
复制代码

 

 

25.给html元素分配一个名为JS的class。

  现代的web apps非常的依赖js,这里的一个技巧就是只有当js可用时才能显示特定的元素。看下面的代码。

复制代码
$(document).ready(function(){
    $('html').addClass('JS');
});


  html.JS #message { display:block; }
 #message {display:none;}
复制代码

这样,只有js可用的时候id为message的元素才会显示;如果不支持js,则该元素不会显示。

 

 

26.监听不存在的元素上的事件。

  jQuery拥有一个先进的事件处理机制,通过on()方法可以监听还不存在的事件。 这是因为on方法可以传递一个元素的子元素选择器作为参数。看下面的例子:

复制代码
<ul id="testList"> <li>Old</li> <li>Old</li> <li>Old</li> <li>Old</li> </ul>

var list = $('#testList');

// Binding an event on the list, but listening for events on the li items:
list.on('click','li',function(){
    $(this).remove();
});


// This allows us to create li elements at a later time,
// while keeping the functionality in the event listener

list.append('<li>New item (click me!)</li>');
复制代码

这样,即使li是后创建的,也可以通过on()方法来监听。

 

27.只使用一次事件监听。

  有时,我们只需要绑定只运行一次的事件处理程序。那么one()方法是一个不错的选择,通过它你就可以高枕无忧了。

  

复制代码
<button id="press">Press me!</ul>
var press = $('#press');

// There is a method that does exactly that, the one():
press.one('click',function(){
    alert('This alert will pop up only once');
});

// What this method does, is call on() behind the scenes,
// with a 1 as the last argument:
// press.on('click',null,null,function(){alert('I am the one and only!');}, 1);
复制代码

 

 

28.模拟触发事件。

  我们可以通过使用trigger模拟触发一个click事件。

复制代码
<button id="press">Press me!</ul>
var press = $('#press');

// Just a regular event listener:
press.on('click',function(e, how){
    how = how || '';
    alert('The buton was clicked ' + how + '!');
});

// Trigger the click event
press.trigger('click');

// Trigger it with an argument
press.trigger('click',['fast']);
复制代码

 

 

29.使用触摸事件。

  使用触摸事件和相关的鼠标事件并没有太多不同,但是你得有一个方便的移动设备来测试会更好。看下面这个例子。

复制代码
// Define some variables
var ball = $('&lt;div id="ball"&gt;&lt;/div&gt;').appendTo('body'),
startPosition = {}, elementPosition = {};

// Listen for mouse and touch events
ball.on('mousedown touchstart',function(e){
    e.preventDefault();

    // Normalizing the touch event object
    e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;

    // Recording current positions
    startPosition = {x: e.pageX, y: e.pageY};
    elementPosition = {x: ball.offset().left, y: ball.offset().top};

    // These event listeners will be removed later
    ball.on('mousemove.rem touchmove.rem',function(e){
        e = (e.originalEvent.touches) ? e.originalEvent.touches[0] : e;

        ball.css({
            top:elementPosition.y + (e.pageY - startPosition.y),
            left: elementPosition.x + (e.pageX - startPosition.x),
        });

    });
});

ball.on('mouseup touchend',function(){
    // Removing the heavy *move listeners
    ball.off('.rem');
});
复制代码

 

30.更好地使用on()/off()方法。

  在jQuery1.7版本时对事件处理进行了简化,看看下面的例子吧。

复制代码
<div id="holder"> <button id="button1">1</button> <button id="button2">2</button> <button id="button3">3</button> <button id="button4">4</button> <button id="clear" style="float: right;">Clear</button> </div>


// Lets cache some selectors

var button1 = $('#button1'),
    button2 = $('#button2'),
    button3 = $('#button3'),
    button4 = $('#button4'),
    clear = $('#clear'),
    holder = $('#holder');

// Case 1: Direct event handling
button1.on('click',function(){
    log('Click');
});

// Case 2: Direct event handling of multiple events
button2.on('mouseenter mouseleave',function(){
    log('In/Out');
});

// Case 3: Data passing
button3.on('click', Math.round(Math.random()*20), function(e){

    // This will print the same number over and over again,
    // as the random number above is generated only once:
    log('Random number: ' + e.data);

});

// Case 4: Events with a namespace
button4.on('click.temp', function(e){
    log('Temp event!');
});

button2.on('click.temp', function(e){
    log('Temp event!');
});

// Case 5: Using event delegation
$('#holder').on('click', '#clear', function(){
    log.clear();
});

// Case 6: Passing an event map
var t; // timer

clear.on({

    'mousedown':function(){

        t = new Date();

    },

    'mouseup':function(){

        if(new Date() - t &gt; 1000){

            // The button has been held pressed
            // for more than a second. Turn off
            // the temp events

            $('button').off('.temp');
            alert('The .temp events were cleared!');
        }

    }
});
复制代码

 

 

31.更快地阻止默认事件行为。

  我们知道js中可以使用preventDefault()方法来阻止默认行为,但是jQuery对此提供了更简单的方法。如下:

<a href="http://google.com/" id="goToGoogle">Go To Google</a>

$('#goToGoogle').click(false);

 

32.使用event.result链接多个事件处理程序。

  对一个元素绑定多个事件处理程序并不常见,而使用event.result更可以将多个事件处理程序联系起来。看下面的例子。

复制代码
<button id="press">点击</button>
 <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
 <script>

var press = $('#press');
press.on('click',function(){
    return 'Hip';
});

// The second event listener has access
// to what was returned from the first

press.on('click',function(e){
    console.log(e.result + ' Hop!');
});
 </script>
复制代码

这样,控制台会输出Hip Hop!

 

 

33.创建你自己习惯的事件。

  你可以使用on()方法创建自己喜欢的事件名称,然后通过trigger来触发。举例如下:

复制代码
<button id="button1">Jump</button> <button id="button2">Punch</button> <button id="button3">Click</button> <button id="clear" style="float: right;">Clear</button> <div id="eventDiv"></div>
     <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>




     <script>

var button1 = $('#button1'),
    button2 = $('#button2'),
    button3 = $('#button3'),
    clear = $('#clear'),
    div = $('#eventDiv');

div.on({
    jump : function(){
        alert('Jumped!');
    },

    punch : function(e,data){
        alert('Punched '+data+'!');
    },

    click : function(){
        alert('Simulated click!');
    }

});

button1.click(function(){
    div.trigger('jump');
});

button2.click(function(){
    // Pass data along with the event
    div.trigger('punch',['hard']);
});

button3.click(function(){
    div.trigger('click');
});

clear.click(function(){
    log.clear();
});

     </script>
复制代码
第三节:Vben Admin 最新 v5.0 (vben5) + Python Flask 快速入门 - 对接后端登录接口(上) 这里是Vben Admin V5版本实战体验,上一节我们前端已正常运行,但是没有实现登录。本节的重点是对接后端接口。上一节地址:第一节:Vben Admin 最新 v5.0初体验第二节:Vben Admin 登录逻辑梳理和对接后端准备后端我们采用Python的Flask项目,Flask-SQLAlchemy管理数据库模型,Flask-Migrate进行模型迁移。参考版本如下:Flask3.0.23.1.1到这里,登录接口完成,下一步要实现获取用户信息和权限的接口功能。 阅读详情

相关推荐

GAN管CGH40010F设计宽带Doherty功放:如何用ADS搞定输入匹配、合路网络与功分器?

本文详细介绍了基于CGH40010F GaN晶体管的宽带Doherty功放设计流程,重点讲解在ADS平台中实现输入匹配网络、合路网络与功分器的关键技术。通过寄生参数补偿、渐变微带线设计和复合补偿结构等方法,解决了宽带化设计中的核心挑战,最终实现1.7-2.6GHz频段内72%的峰值效率和52%的回退效率。

weixin_42614269的博客 473

手把手教你给SQL Server 2019设置‘自动保洁员’:用代理作业定时清理日志,解放C盘

本文详细介绍了如何为SQL Server 2019配置自动化日志清理方案,通过代理作业定时清理日志文件,有效释放C盘空间。文章提供了完整的SQL脚本和最佳实践,包括安全配置、智能调度和监控报警,帮助DBA实现高效、安全的日志管理。

weixin_33733810的博客 388

DSP复习笔记(5)——外部接口模块XINTF

【注意】 1. 芯片型号:TMS320F28335 2. 适用于NJUSTEO李彧晟老师课程 3. 参考资料:《TMS320F28335 DSP原理、开发及应用》 4. 对应PPT第二章 5. 本章内容较多而且较为重要,请结合PPT一起复习

BerenCamlost的博客 1万+

jQuery 编程的 100 个实用技巧:原理解析与代码示例

本文详细介绍了 100 个 jQuery 编程技巧,涵盖了选择器、DOM 操作、事件处理、动画、Ajax、表单操作等多个方面。通过掌握这些技巧,开发者可以更高效地使用 jQuery 构建动态、交互性强的网页应用。尽管现代前端开发中,原生 JavaScript 和框架逐渐成为主流,但 jQuery 仍然是许多项目中的重要工具。

百锦再的博客 9008

海思ISP调优实战:从实验室到真实场景的IPC相机图像质量优化指南

本文深入探讨海思ISP调优在IPC相机图像质量优化中的实战应用,从实验室标定到真实场景部署的全链路调优方法。重点解决光照动态范围、色温变化和噪声特性等核心问题,提供AE权重表配置、CCM标定、3DNR时域滤波等关键技术方案,帮助实现从理论到实践的图像质量提升。

s3t4u的博客 751

NXP KW45开发实战:如何在MCUXpresso IDE中正确配置J-Link并解决设备识别问题

本文详细介绍了在MCUXpresso IDE中配置J-Link以支持NXP KW45无线MCU开发的实战指南。从环境准备到J-Link深度配置,再到烧录流程优化和高级调试技巧,帮助开发者高效解决设备识别问题并提升开发效率。特别推荐使用JLinkRemoteServer.exe进行多设备并行调试,并提供了烧录速度优化和低功耗调试的实用技巧。

gray5的博客 867

jQuery的100个使用技巧

1.当document文档就绪时执行JavaScript代码。   我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行。 "http://code.jquery.com/jquery-1.10.2.min.js"> // Different ways

xjanting的博客 655

Innovus 安装全过程

【代码】Innovus 安装全过程。

lmyynlbcy的博客 5552

JQuery中的100个技巧

1.当document文档就绪时执行JavaScript代码。   我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行。 <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <scrip...

weixin_30470857的博客 80

OpenClaw本地部署教程

本文详细介绍了在Windows 11系统上部署OpenClaw与Ollama本地模型的完整流程。主要内容包括:硬件要求说明、Node.js环境配置、Ollama模型安装与定制(重点扩展上下文窗口至32768 tokens)、OpenClaw核心框架安装与对接、常见问题解决(如模型上下文窗口过小报错)以及可选技能扩展和飞书接入方案。部署全程约需1-2小时,强调使用备用设备或虚拟机以确保安全,并提供关键配置参数和排错命令。该方案实现了"数据不出门、推理本地化"的私有化部署目标。

技术引领业务创新 2593

具身智能的建模和方法(具身智能入门一)

本文以机械臂将小红方块移动到目标位置为例对具身智能的建模和方法进行介绍,如下图所示,该例子来自https://ai-workshops.github.io/building-and-working-in-environments-for-embodied-ai-cvpr-2022/。

weixin_39699362的博客 1466

jQuery中的100个技巧(译)

1.当document文档就绪时执行JavaScript代码。   我们为什么使用jQuery库呢?原因之一就在于我们可以使jQuery代码在各种不同的浏览器和存在bug的浏览器上完美运行。 &lt;script src="http://code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt; &...

weixin_33895695的博客 251

Verilog HDL 100道面试题及参考答案

在 Verilog HDL 中,参数(parameter)和宏定义(define)都可用于定义常量,但它们存在诸多不同之处。参数(parameter)是模块内部的常量定义,具有局部性。它在模块内部起作用,不同模块可以有同名的参数,且值可以不同。参数通常用于定义模块的一些配置信息,例如数据位宽、延迟时间等。参数的定义和使用是在模块的作用域内进行的,通过参数传递可以方便地对模块进行配置。endmodule在上述代码中,WIDTH是一个参数,用于定义加法器的位宽。通过改变WIDTH。

大模型大数据攻城狮的专栏 1737

jQuery 中的 39 个技巧

原文地址:http://www.codeceo.com/article/100-tips-in-jquery.html 转载于:https://www.cnblogs.com/LoveLuHan/p/6229820.html

weixin_30247159的博客 78

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

使用jQuery实现列表循环滚动小技巧,2024年最新我总结了24家大厂100份面试题英文

从转行到现在,差不多两年的时间,虽不能和大佬相比,但也是学了很多东西。我个人在学习的过程中,习惯简单做做笔记,方便自己复习的时候能够快速理解,现在将自己的笔记分享出来,和大家共同学习。个人将这段时间所学的知识,分为三个阶段:第一阶段:HTML&CSS&JavaScript基础第二阶段:移动端开发技术第三阶段:前端常用框架推荐学习方式:针对某个知识点,可以先简单过一下我的笔记,如果理解,那是最好,可以帮助快速解决问题;如果因为我的笔记太过简陋不理解,可以关注我以后我还会继续分享。

2401_84141332的博客 1227

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

jquery mobile图片自适应屏幕

jquery mobile中如果不给img标签指定宽度的话,无法达到自适应屏幕的效果,特此备注:width:100%;

赠人玫瑰,手留余香. 8198

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

jQuery介绍

jQuery是目前使用最广泛的javascript函数库。据统计,全世界排名前100万的网站,有46%使用jQuery,远远超过其他库。微软公司甚至把jQuery作为他们的官方库。 jQuery的版本分为1.x系列和2.x、3.x系列,1.x系列兼容低版本的浏览器,2.x、3.x系列放弃支持低版本浏览器,目前使用最多的是1.x系列的。 jquery是一个函数库,一个js文件,页面用script...

weixin_30664051的博客 80

前端-JQuery.delay()方法在css()上使用

$("div").delay(100).queue(function(next){//queue()方法显示或操作在元素上执行的函数队列。 $(this).css("position","fixed"); next();//这里必须加next,否则queue只会执行一次 })   ...

weixin_41395648的博客 757

Callback方法和JQuery链的解释

  这里讲到了一条语句运行多个JQuery方法(同一个元素)和动画100%完成后执行的callback方法。    <!DOCTYPE html> <html> <head> <title>Callback方法和链的解释</title> <script type="text/javascript" s...

weixin_30709635的博客 174

JQuery常用代码片段

1. 如何创建嵌套的过滤器 //允许你减少集合中的匹配元素的过滤器, //只剩下那些与给定的选择器匹配的部分。在这种情况下, //查询删除了任何没(:not)有(:has) //包含class为“selected”(.selected)的子节点。 .filter(":not(:has(.selected))")   2. 如何重用元素搜索 var allItem

RenJanely的专栏 560
上一篇: 利用redis缓存对 list集合中的数据 进行分页操作
lyhjava
博客等级 码龄11年 15粉丝 1原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值