Uncaught TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'
See original GitHub issueHi everybody, I’m trying to add the swiper script to my web app and i’m encoutering this error :
Uncaught TypeError: Failed to execute ‘getComputedStyle’ on ‘Window’: parameter 1 is not of type ‘Element’. swiper.jquery.js:1588 s.getTranslate swiper.jquery.js:1588 s.getWrapperTranslate swiper.jquery.js:1628 s.onTouchMove swiper.jquery.js:1098
The app is developped in struts 2. Please find below the code of my jsp that fires the error :
<div class="swiper-container">
<div class="swipper-wrapper" id="slide"></div>
<!-- If we need pagination -->
<div class="swiper-pagination"></div>
<!-- If we need navigation buttons -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
<!-- If we need scrollbar -->
<div class="swiper-scrollbar"></div>
</div>
<script type="text/javascript">
//récupération du fichier json grace à url avec valeurs insérer ds var data
var myJson;
$.getJSON( "http://localhost:8080/version_test_appli1_16_swiper/getJSONResult.action",
function( data ) {
myJson = data;
}
);
//alert pour vérifier si on récupère bien le fichier json
var jqxhr = $.getJSON( "version_test_appli1_16_swiper/getJSONResult.action",
function( data ) {
console.log( "success "+data );
myJson = data['rows'];
var txt = "";
for( var key in myJson )
txt += key+":"+myJson[key];
alert( txt );
var nbLigne = myJson.length;
var maxLigne = 10;
// on répète la creation du tableau toute les 10 lignes
for( var iTable = 0; iTable < nbLigne; iTable+=maxLigne ){
var div = document.createElement('div');
div.setAttribute("class", "swiper-slide");
//div.id = "blabla";
var table = document.createElement("table");
div.appendChild( table );
// pour l'entete
var tr = document.createElement( 'tr' );
var th = document.createElement('th');
th.innerHTML = "Objet";
tr.appendChild( th );
th = document.createElement('th');
th.innerHTML = "Date";
tr.appendChild( th );
th = document.createElement('th');
th.innerHTML = "Type séance";
tr.appendChild( th );
th = document.createElement('th');
th.innerHTML = "Numéro";
tr.appendChild( th );
table.appendChild( tr );
// pour le corps
for( var iLigne=iTable; iLigne < iTable+maxLigne ; iLigne++ ){
var ligne = myJson[iLigne];
tr = document.createElement( 'tr' );
for( var iCell in ligne ){
var cell = ligne[iCell];
var td = document.createElement('td');
td.innerHTML = cell;
tr.appendChild( td );
}
table.appendChild( tr );
}
var divGrid = document.getElementById("slide");
divGrid.appendChild( div );
}
})
.done(function( data ) {
console.log( "second success "+data );
})
.fail(function( data ) {
console.log( "error "+data );
})
//initialisation du swiper quand le document est pret avec Jquery
$(document).ready(function () {
//initialize swiper when document ready
var mySwiper = new Swiper ('.swiper-container', {
// Optional parameters
direction: 'horizontal',
loop: true
})
});
</script>
Please tell me if you need any more information in order to help. I’ll be very gratefull for your help. Thanks a lot !!! And sorry again I’m VERY new to git hub and swipper 😉
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
JS: Failed to execute 'getComputedStyle' on 'Window ...
In short: I am trying to understand the meaning of this TypeError: Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of...
Read more >Failed to execute 'getComputedStyle' on 'Window' - OutSystems
On my mobile app i am getting an Error on every page which says "Failed to execute 'getComputedStyle' on 'Window': parameter 1 is...
Read more >Failed to execute 'getComputedStyle' on 'Window': param 1 is ...
Uncaught TypeError : Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. at HTMLBodyElement.
Read more >parameter 1 is not of type 'Element'. HELP : r/learnjavascript
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. HELP : r/learnjavascript.
Read more >T280305 Failed to execute 'getComputedStyle' on 'Window'
Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'. Closed, InvalidPublicPRODUCTION ERROR.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi ! Ok today I’ve fixed my eyes and I’ve found the problem : swiper spelt with two p…
instead of :
Now it is working fine ! Thank you again for your help and for this very cool touch slider !
What do you mean with live example ? The thing is that i’m developing the app locally on a tomcat server. I don’t how I can give you access to it, Teamviewer ? On the other hand, if you’ve got the whole sources would that help you ? Thank you again for your precious help !