swiper插件在ie瀏覽器無反應,解決辦法

来源:https://www.cnblogs.com/cyhsmile/archive/2019/09/16/11527260.html
-Advertisement-
Play Games

在寫pc端頁面時,用swiper插件發現在ie中用不了,百度下說是swiper從3以後向手機端發展,所以在pc端無響應。後來瞭解到,swiper3是專門針對移動端寫的。如果想相容IE8的話,應該引入swiper2. 也就是:idangerous.swiper.js 官網演示地址:http://2.s ...


               在寫pc端頁面時,用swiper插件發現在ie中用不了,百度下說是swiper從3以後向手機端發展,所以在pc端無響應。後來瞭解到,swiper3是專門針對移動端寫的。如果想相容IE8的話,應該引入swiper2. 
也就是:idangerous.swiper.js

官網演示地址:http://2.swiper.com.cn/demo/

swiper2下載地址

鏈接:https://pan.baidu.com/s/1rWhJ1sCbcJVf4wfBRq_MYg 密碼:qcuw
參考源碼:

css:

<link rel="stylesheet" type="text/css" href="../css/idangerous.swiper.css" />

js

<script src="../js/idangerous.swiper.js" type="text/javascript" charset="utf-8"></script>

html

  <div class="container-middle-solution">

<div class="swiper-container"> <div class="swiper-wrapper"> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div> <a class="title">網路解決方案</a> </div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>移動解決方案</div> <div>我們做iOS應用開發,Android應用開發,混合APP開發以及移動應用市場咨詢。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>網路解決方案</div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>網路解決方案</div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>網路解決方案</div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>網路解決方案</div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> <div class="swiper-slide"> <div class="container-middle-solution-pc"> <div>網路解決方案</div> <div>我們做響應網站,網頁開發,區塊鏈開發,UI/UX設計,CRM解決方案,托管伺服器解決方案。</div> <div> <img src="../img/index-pc.png"> </div> </div> </div> </div> <!-- Add Arrows --> <!--<div class="icon-left">--> <!--<div class="swiper-button-next"></div> <div class="swiper-button-prev"></div>--> <a class="arrow-left" href="#"></a> <a class="arrow-right" href="#"></a> </div> </div>

<script type="text/javascript">
var swiper = new Swiper('.swiper-container', {
// slidesPerView: "auto",
slidesPerView: 2,
spaceBetween: 0,
// mode: 'vertical', //2版本垂直滑動
// direction: 'vertical', //3版本垂直滑動
// pagination: {
// el: '.swiper-pagination',
// clickable: true,
// },
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
$('.arrow-left').on('click', function(e) {
e.preventDefault();
swiper.swipePrev();
})
$('.arrow-right').on('click', function(e) {
e.preventDefault();
swiper.swipeNext();
})
</script>

 

css樣式問題

.swiper-container {
                width: 100%;
                padding-bottom: 100px;
            }
            
            /*.swiper-slide {
                background-position: center;
                background-size: cover;
                display: -webkit-box;
                display: -ms-flexbox;
                display: -webkit-flex;
                display: flex;
                -webkit-box-pack: center;
                -ms-flex-pack: center;
                -webkit-justify-content: center;
                justify-content: center;
                -webkit-box-align: center;
                -ms-flex-align: center;
                -webkit-align-items: center;
                align-items: center;
            }*/
            
            .swiper-button-prev,
            .swiper-container-rtl .swiper-button-next {
                background: url(../img/index-left.png) center center no-repeat;
                background-size: 100%;
                100%;
                left: 52px;
                right: auto;
                top: 220px;
                width: 54px;
                height: 54px;
            }
            /*.arrow-left {
                background: url(../img/index-left.png) center center no-repeat;
                background-size: 100%;
                100%;
                left: 52px;
                right: auto;
                top: 220px;
                width: 54px;
                height: 54px;
            }*/
            
            .arrow-left {
                background: url(../img/index-left.png) no-repeat left top;
                position: absolute;
                left: 36px;
                top: 180px;
                margin-top: -15px;
                width: 54px;
                height: 54px;
                background-size: 100% 100%;
            }
            
            .arrow-right {
                background: url(../img/index-right.png) no-repeat left bottom;
                position: absolute;
                /* right: 10px; */
                left: 110px;
                top: 180px;
                margin-top: -15px;
                width: 54px;
                height: 54px;
                background-size: 100% 100%;
            }

效果

 

註意:在引用css2.0是有些樣式之前寫的4.0的,所以樣式要改,要不然起衝突

 


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 利用快速原型獲取軟體需求 在客戶 開發商 用戶 之間 旨在啟發客戶 引導客戶真正知道和瞭解自己的可行需求 快速搭建原型 高效準確地確定用戶需求 我們可能要用到一個軟體需求方面的知識-快速原型 例子 以CSS語言為例從一個最最最的教務系統入手 代碼如下: <html><center><h2>歡迎返校! ...
  • 以下通過一段示例代碼,說明原型模型中的基本概念以及知識點。 部分摘自《JavaScript高級程式設計(第3版)》 ...
  • 前言 最近在看 React 的新語法—— ,只能一句話概括:React 語法真的是越來越強大,越寫代碼越少。 強烈推薦還沒看 React Hooks 的同學去學習下,這會讓你寫react 項目變得非常爽! 以前 React 組件可以看成是: 無狀態組件(function定義)和有狀態組件(class ...
  • [TOC] 1. 繼承性 繼承性:在css有某些屬性是可以繼承下來,如 color,text xxx,line height,font xxx,letter spacing,word spacing是可以繼承下來,但有些屬性是不可以繼承下來的,如 border:1px solid green; 2. ...
  • [TOC] css: 層疊樣式表 1. css引入方式 行內樣式 內嵌式 在head標簽內部書寫style 外接式 三種引入方式的優先順序: 1.行內樣式 內嵌式和外接式, 2.內嵌和外接要看誰在後面,在後面的優先順序高 2. css選擇器 2.1 基礎選擇器 1.id選擇器 特定屬性的元素(標簽)、唯 ...
  • HTML HTML 超文本標記語言 HTML特征: 對換行和空格不敏感 空白摺疊 1.1 HTML標簽 標簽也稱為標記。 標簽的種類: 1.雙閉合標簽 2.單閉合標簽 1.1.1 head標簽 meta 提供基本網站元信息的標簽 title 顯示網站的標題 link 鏈接css資源文件、網站圖標 s ...
  • 什麼是 JavaScript? JavaScript 是一種直譯式腳本語言,一種輕量級的腳本語言 它可以在網頁上實現複雜的功能,網頁展現給你的不再是簡單的靜態信息,而是實時的內容更新,互動式的地圖,2D/3D 動畫,滾動播放的視頻等等。JavaScript 怎能缺席。它是標準 Web 技術蛋糕的第三 ...
  • 1、JS的核心標準ECMAScript 組成 ECMAScript >核心語法標準 DOM >對文檔節點的操作 BOM >對瀏覽器的操作 2、JS的註釋: 單行註釋 //註釋內容 多行註釋 /* 註釋內容 */ 3、JS的保留字和關鍵字 關鍵字:有特殊功能的單詞如: break do try typ ...
一周排行
    -Advertisement-
    Play Games
  • 前言 本文介紹一款使用 C# 與 WPF 開發的音頻播放器,其界面簡潔大方,操作體驗流暢。該播放器支持多種音頻格式(如 MP4、WMA、OGG、FLAC 等),並具備標記、實時歌詞顯示等功能。 另外,還支持換膚及多語言(中英文)切換。核心音頻處理採用 FFmpeg 組件,獲得了廣泛認可,目前 Git ...
  • OAuth2.0授權驗證-gitee授權碼模式 本文主要介紹如何筆者自己是如何使用gitee提供的OAuth2.0協議完成授權驗證並登錄到自己的系統,完整模式如圖 1、創建應用 打開gitee個人中心->第三方應用->創建應用 創建應用後在我的應用界面,查看已創建應用的Client ID和Clien ...
  • 解決了這個問題:《winForm下,fastReport.net 從.net framework 升級到.net5遇到的錯誤“Operation is not supported on this platform.”》 本文內容轉載自:https://www.fcnsoft.com/Home/Sho ...
  • 國內文章 WPF 從裸 Win 32 的 WM_Pointer 消息獲取觸摸點繪製筆跡 https://www.cnblogs.com/lindexi/p/18390983 本文將告訴大家如何在 WPF 裡面,接收裸 Win 32 的 WM_Pointer 消息,從消息裡面獲取觸摸點信息,使用觸摸點 ...
  • 前言 給大家推薦一個專為新零售快消行業打造了一套高效的進銷存管理系統。 系統不僅具備強大的庫存管理功能,還集成了高性能的輕量級 POS 解決方案,確保頁面載入速度極快,提供良好的用戶體驗。 項目介紹 Dorisoy.POS 是一款基於 .NET 7 和 Angular 4 開發的新零售快消進銷存管理 ...
  • ABP CLI常用的代碼分享 一、確保環境配置正確 安裝.NET CLI: ABP CLI是基於.NET Core或.NET 5/6/7等更高版本構建的,因此首先需要在你的開發環境中安裝.NET CLI。這可以通過訪問Microsoft官網下載並安裝相應版本的.NET SDK來實現。 安裝ABP ...
  • 問題 問題是這樣的:第三方的webapi,需要先調用登陸介面獲取Cookie,訪問其它介面時攜帶Cookie信息。 但使用HttpClient類調用登陸介面,返回的Headers中沒有找到Cookie信息。 分析 首先,使用Postman測試該登陸介面,正常返回Cookie信息,說明是HttpCli ...
  • 國內文章 關於.NET在中國為什麼工資低的分析 https://www.cnblogs.com/thinkingmore/p/18406244 .NET在中國開發者的薪資偏低,主要因市場需求、技術棧選擇和企業文化等因素所致。歷史上,.NET曾因微軟的閉源策略發展受限,儘管後來推出了跨平臺的.NET ...
  • 在WPF開發應用中,動畫不僅可以引起用戶的註意與興趣,而且還使軟體更加便於使用。前面幾篇文章講解了畫筆(Brush),形狀(Shape),幾何圖形(Geometry),變換(Transform)等相關內容,今天繼續講解動畫相關內容和知識點,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 什麼是委托? 委托可以說是把一個方法代入另一個方法執行,相當於指向函數的指針;事件就相當於保存委托的數組; 1.實例化委托的方式: 方式1:通過new創建實例: public delegate void ShowDelegate(); 或者 public delegate string ShowDe ...