jasny和bootstrap-fileinput功能扩展插件同时使⽤冲突解决办法jasny和bootstrap-fileinput功能扩展插件同时使⽤冲突解决办法
1.冲突配置
include.html
<!-- jasny功能扩展插件 -->
<div fragment="jasny-bootstrap-css">
<link href="@{/ajax/libs/jasny/jasny-bootstrap.min.css}"rel="stylesheet"/>
</div>
<div fragment="jasny-bootstrap-js">
<script src="@{/ajax/libs/jasny/jasny-bootstrap.js}"></script>
</div>
<!-- fileinput⽂件上传插件 -->
<div fragment="bootstrap-fileinput-css">
<link href="@{/ajax/libs/bootstrap-fileinput/fileinput.min.css}"rel="stylesheet"/>result搭配
</div>
<div fragment="bootstrap-fileinput-js">
<script src="@{/ajax/libs/bootstrap-fileinput/fileinput.min.js}"></script>
</div>
html引⽤
<!DOCTYPE html>
<html lang="zh"th="">
<head>
<block include="include :: jasny-bootstrap-css"/>
<block include="include :: bootstrap-fileinput-css"/>
<block include="include :: jasny-bootstrap-js"/>
<block include="include :: bootstrap-fileinput-js"/>
</head>
2.解决冲突
include.html
<!-- jasny功能扩展插件 -->
<div fragment="jasny-bootstrap-css">
<link href="@{/ajax/libs/jasny/jasny-bootstrap.min.css}"rel="stylesheet"/>
</div>
<div fragment="jasny-bootstrap-js">
<script src="@{/ajax/libs/jasny/jasny-bootstrap.js}"></script>
</div>
<!-- jasny与bootstrap-fileinput扩展插件同时使⽤时冲突,改⽤下⾯js -->
<div fragment="alias-jasny-bootstrap-js">
<script src="@{/ajax/libs/jasny/alias-jasny-bootstrap.js}"></script>
</div>
<!-- fileinput⽂件上传插件 -->
<div fragment="bootstrap-fileinput-css">
<link href="@{/ajax/libs/bootstrap-fileinput/fileinput.min.css}"rel="stylesheet"/>
</div>
<div fragment="bootstrap-fileinput-js">
<script src="@{/ajax/libs/bootstrap-fileinput/fileinput.min.js}"></script>
</div>
html引⽤
<!DOCTYPE html>特效素材在哪里下载
<html lang="zh"th="">
<head>
<block include="include :: jasny-bootstrap-css"/>
<block include="include :: bootstrap-fileinput-css"/>
<block include="include :: alias-jasny-bootstrap-js"/>
<block include="include :: bootstrap-fileinput-js"/>
</head>
alias-jasny-bootstrap.js
修改内容:
// rename function
$.fn.jasnyfileinput = $.fn.fileinput
$.fn.jasnyfileinput.Constructor = Fileinput
// FILEUPLOAD DATA-API
// ==================
$(document).on('click.fileinput.data-api','[data-provides="fileinput"]',function(e){
var $this=$(this)
if($this.data('bs.fileinput'))return
// invoke jasnyfileinput
$this.jasnyfileinput($this.data())
var $target =$(e.target).closest('[data-dismiss="fileinput"],[data-trigger="fileinput"]');
if($target.length >0){
e.preventDefault()
$igger('click.bs.fileinput')
}
})
完整代码
/*!
* Jasny Bootstrap v3.1.3 (jasny.github.io/bootstrap)
* Copyright 2012-2014 Arnold Daniels
* Licensed under Apache-2.0 (github/jasny/bootstrap/blob/master/LICENSE)
*/
if(typeof jQuery ==='undefined'){throw new Error('Jasny Bootstrap\'s JavaScript requires jQuery')} /* ========================================================================
* Bootstrap: transition.js v3.1.3
access数据库设计作品* getbootstrap/javascript/#transitions
* ========================================================================
* Copyright 2011-2014 Twitter, Inc.
* Licensed under MIT (github/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function($){
'use strict';
// CSS TRANSITION SUPPORT (Shoutout: dernizr/)
// ============================================================
function transitionEnd(){
var el = ateElement('bootstrap')
var transEndEventNames ={
var transEndEventNames ={
WebkitTransition :'webkitTransitionEnd',
MozTransition    :'transitionend',
OTransition      :'oTransitionEnd otransitionend',
transition      :'transitionend'
}
for(var name in transEndEventNames){
if(el.style[name]!== undefined){
return{ end: transEndEventNames[name]}
}
}
return false// explicit for ie8 (  ._.)
}
if($.ansition !== undefined)return// Prevent conflict with Twitter Bootstrap
// blog.alexmaccaw/css-transitions
$.fn.emulateTransitionEnd=function(duration){
var called =false, $el =this
$(this).one($.d,function(){ called =true})
var callback=function(){if(!called)$($el).trigger($.d)}
setTimeout(callback, duration)
return this
}
$(function(){
负载均衡怎么用$.ansition =transitionEnd()
})
}(window.jQuery);
/* ======================================================================== * Bootstrap: offcanvas.js v3.1.3
* jasny.github.io/bootstrap/javascript/#offcanvas
* ======================================================================== * Copyright 2013-2014 Arnold Daniels
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* /licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ======================================================================== */ +function($){"use strict";
// OFFCANVAS PUBLIC CLASS DEFINITION
// =================================
var OffCanvas=function(element, options){
this.$element =$(element)
this.options  = $.extend({}, OffCanvas.DEFAULTS, options)
this.state    =null
this.placement =null
if(alc){
this.calcClone()
$(window).on('resize', $.alc,this))
}
if(this.options.autohide)
if(this.options.autohide)
$(document).on('click', $.proxy(this.autohide,this))
if(le()
if(this.options.disablescrolling){
this.options.disableScrolling =this.options.disablescrolling
delete this.options.disablescrolling
}
}
OffCanvas.DEFAULTS={
toggle:true,
placement:'auto',
autohide:true,
recalc:true,
disableScrolling:true
}
OffCanvas.prototype.offset=function(){
switch(this.placement){
case'left':
case'right':return this.$element.outerWidth()
case'top':
case'bottom':return this.$element.outerHeight()
}
}
OffCanvas.prototype.calcPlacement=function(){
if(this.options.placement !=='auto'){
this.placement =this.options.placement
return
}
if(!this.$element.hasClass('in')){
this.$element.css('visiblity','hidden !important').addClass('in')
}
var horizontal =$(window).width()/this.$element.width()
var vertical =$(window).height()/this.$element.height()
var element =this.$element
function ab(a, b){
if(element.css(b)==='auto')return a
if(element.css(a)==='auto')return b
var size_a =parseInt(element.css(a),10)
var size_b =parseInt(element.css(b),10)
return size_a > size_b ? b : a
}
this.placement = horizontal >= vertical ?ab('left','right'):ab('top','bottom')
if(this.$element.css('visibility')==='hidden !important'){
this.$veClass('in').css('visiblity','')
}
}
OffCanvas.prototype.opposite=function(placement){
多线程是什么梗
switch(placement){
case'top':return'bottom'
case'left':return'right'
case'bottom':return'top'
case'right':return'left'
}
}
}
CanvasElements=function(){
// Return a set containing the canvas plus all fixed elements
var canvas =this.options.canvas ?$(this.options.canvas):this.$element
var fixed_elements = canvas.find('*').filter(function(){
return$(this).css('position')==='fixed'
}).not(lude)
return canvas.add(fixed_elements)
}
OffCanvas.prototype.slide=function(elements, offset, callback){
// Use jQuery animation if CSS transitions aren't supported
if(!$.ansition){
var anim ={}
anim[this.placement]="+="+ offset
return elements.animate(anim,350, callback)
}
var placement =this.placement
var opposite =this.opposite(placement)
elements.each(function(){
if($(this).css(placement)!=='auto')
$(this).css(placement,(parseInt($(this).css(placement),10)||0)+ offset)
if($(this).css(opposite)!=='auto')
$(this).css(opposite,(parseInt($(this).css(opposite),10)||0)- offset)
})
this.$element
.one($.d, callback)
.emulateTransitionEnd(350)
}
OffCanvas.prototype.disableScrolling=function(){
var bodyWidth =$('body').width()
jquery下载文件插件
var prop ='padding-'+this.opposite(this.placement)
if($('body').data('offcanvas-style')=== undefined){
$('body').data('offcanvas-style',$('body').attr('style')||'')
}
$('body').css('overflow','hidden')
if($('body').width()> bodyWidth){
var padding =parseInt($('body').css(prop),10)+$('body').width()- bodyWidth
setTimeout(function(){
$('body').css(prop, padding)
},1)
}
}
OffCanvas.prototype.show=function(){
if(this.state)return
var startEvent = $.Event('show.bs.offcanvas')
this.$igger(startEvent)
if(startEvent.isDefaultPrevented())return
this.state ='slide-in'
this.calcPlacement();

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。