小编OMG*_*ula的帖子

带有居中 div 和多个 div 显示的 Bootstrap Carousel

所以简而言之,我需要这个插件中完全类似于“居中模式”的东西

http://kenwheeler.github.io/slick/

在此处输入图片说明

我需要这样做,但使用引导程序。作为领导希望尽可能避免使用插件。除非仅使用插件会更简单。

我所在项目的首席开发人员希望尽可能避免添加插件。我们正在使用 bootstrap 3,他认为可以编辑 bootstrap 附带的 carousel 来执行我们需要的操作。尝试编辑轮播或从头开始构建一些东西会更省时吗(在这一点上使用插件是否有意义?)

我唯一的想法是有一个 div,有一堆在点击时翻译的内联 div。那会是正确的方法吗?

或者有没有一种简单的方法来操纵内置的轮播?

Codepen 了解我目前所处的位置。

http://codepen.io/OMGDrAcula/pen/eJjgwN

h2{
    margin: 0;     
    color: #666;
    padding-top: 90px;
    font-size: 52px;
    font-family: "trebuchet ms", sans-serif;    
}

.item{
    background: white;    
    text-align: center;
    height: 300px !important;
    display: inline-block;
}

.carousel{
    margin-top: 20px;
}

.bs-example{
	margin: 20px;
}

.carousel.carousel-fade .item {
  opacity:0;
  filter: alpha(opacity=0); /* ie fix */
}

.carousel.carousel-fade .active.item {
    opacity:1;
    filter: alpha(opacity=100); /* ie fix */
}
Run Code Online (Sandbox Code Playgroud)
<head>
<meta charset="UTF-8">
<title>Example of Twitter Bootstrap 3 …
Run Code Online (Sandbox Code Playgroud)

html css jquery carousel twitter-bootstrap

5
推荐指数
1
解决办法
2万
查看次数

触摸屏上的“轮”事件

我有这个小提琴https://jsfiddle.net/316n1xmL/1/它完美地工作,我需要它在桌面上。根据滚轮滚动方向向上或向下计数并添加和删除类。我遇到的问题是如何在触摸屏上执行此操作。

我尝试过hammer.js,但他们的文档真的很糟糕而且不清楚。

遗憾的是,我正在构建的网站使用的是 bootstrap 4,这意味着我不能使用 juqery mobile,因为 BS4 使用不支持 jquery mobile 的 jquery 3。

任何帮助表示赞赏

// Scroll Direction Plugin Move Later to own file

!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?module.exports=a:a(jQuery)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||f>n)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120===0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})});

$(document).ready(function() {
    
    var counter = 0;
    var scrollThreshold = 15;

    var tiles = $('.list-tile');

    $(window).on('wheel', function(event){
        // deltaY obviously records …
Run Code Online (Sandbox Code Playgroud)

javascript jquery scroll touch

5
推荐指数
1
解决办法
9619
查看次数

未捕获的类型错误:无法读取未定义的属性(读取“爱好”)

我遇到了一个有趣的问题,这让我陷入了困境。我正在执行一个 Sharepoint RestAPI 调用,该调用可以正确返回数据,当我对数据运行 for 循环时,它会构建出 html,但仍然会抛出我用作标题的错误。代码如下。如果我控制台记录每个循环,它将返回值。HTML 也可以正常工作。问题是错误仍然出现。

function getSlideData() {
    var query = "$expand=AttachmentFiles&$select=Title,Team,State,Location,Hobbies,Favorite,Askme,GreatPlace,imageFact,ImageText,Attachments,AttachmentFiles&$expand=AttachmentFiles&$top=1000&$orderby=Created desc&$filter=Display eq 'Active'";
    var svcUrl = SITE_URL + "_api/web/lists/getbytitle('"+LIST_NAME+"')/items?"+query;
    var employeeData;

    $.ajax({
        url: svcUrl,
        type: "GET",
        headers: { "Accept": "application/json; odata=verbose" },
        async: false,
        success: function (data) {
            employeeData = data.d.results;
        },
        error: function (xhr) {
            alert("Can't get list items.", xhr.status + ": " + xhr.statusText); 
        }
    });

    return employeeData;
}

function buildSlides() {
    var slideData = getSlideData();
    var sliderWrapper = $('#slider-wrapper');
    var sliderWrapperContent = …
Run Code Online (Sandbox Code Playgroud)

javascript sharepoint for-loop

4
推荐指数
1
解决办法
7万
查看次数