kickflowers Posted August 14, 2012 Share Posted August 14, 2012 ]Bonjour à tous, je suis nouveau et j'ai encore beaucoup de choses à apprendre de vous. J'essaie tant bien que mal de créer un module qui permettra d'avoir un slider en arrière plan à l'image de ce que fait http://www.grosbill.com/. Je vous met donc à disposition mon module et j'ai besoin de votre aide pour le finaliser. Mes problèmes : les images ne 'affichent pas. les autres scripts semblent désormais inactif... Merci d'avance à tous ! Le fichier PHP : Le code du tpl : <!-- superslider --> <script type="text/javascript" src="{$module_dir}js/scriptsuperslider.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="{$module_dir}css/superslider.css" /> <div id="headerslider"> <!-- jQuery handles to place the header background images --> <div id="headerimgs"> <div id="headerimg1" class="headerimg"></div> <div id="headerimg2" class="headerimg"></div> </div> <!-- Slideshow controls --> <div id="headernav-outer"> <div id="headernav"> <div id="back" class="btn"></div> <div id="control" class="btn"></div> <div id="next" class="btn"></div> </div> </div> <!-- jQuery handles for the text displayed on top of the images --> <div id="headertxt"> <p class="caption"> <span id="firstline"></span> <a href="#" id="secondline"></a> </p> <p class="pictured"> image: <a href="#" id="pictureduri"></a> </p> </div> </div> <!-- /superslider --> Le code du script : // Speed of the automatic slideshow var slideshowSpeed = 5000; // Variable to store the images we need to set as background // which also includes some text and url's. var photos = [ { "title" : "Stairs", "image" : "vacation.jpg", "url" : "http://localhost/smartblettes/modules/superslider/images/vacation.jpg", "firstline" : "Going on", "secondline" : "vacation?" }, { "title" : "Office Appartments", "image" : "work.jpg", "url" : "http://localhost/smartblettes/modules/superslider/images/work.jpg", "firstline" : "Or still busy at", "secondline" : "work?" }, { "title" : "Mountainbiking", "image" : "biking.jpg", "url" : "http://localhost/smartblettes/modules/superslider/images/biking.jpg", "firstline" : "Get out and be", "secondline" : "active" }, { "title" : "Mountains Landscape", "image" : "nature.jpg", "url" : "http://localhost/smartblettes/modules/superslider/images/nature.jpg", "firstline" : "Take a fresh breath of", "secondline" : "nature" }, { "title" : "Italian pizza", "image" : "food.jpg", "url" : "http://localhost/smartblettes/modules/superslider/images/food.jpg", "firstline" : "Enjoy some delicious", "secondline" : "food" } // More pictures if we want ]; $(document).ready(function() { // Backwards navigation $("#back").click(function() { stopAnimation(); navigate("back"); }); // Forward navigation $("#next").click(function() { stopAnimation(); navigate("next"); }); var interval; $("#control").toggle(function(){ stopAnimation(); }, function() { // Change the background image to "pause" $(this).css({ "background-image" : "url(images/btn_pause.png)" }); // Show the next image navigate("next"); // Start playing the animation interval = setInterval(function() { navigate("next"); }, slideshowSpeed); }); var activeContainer = 1; var currentImg = 0; var animating = false; var navigate = function(direction) { // Check if no animation is running. If it is, prevent the action if(animating) { return; } // Check which current image we need to show if(direction == "next") { currentImg++; if(currentImg == photos.length + 1) { currentImg = 1; } } else { currentImg--; if(currentImg == 0) { currentImg = photos.length; } } // Check which container we need to use var currentContainer = activeContainer; if(activeContainer == 1) { activeContainer = 2; } else { activeContainer = 1; } showImage(photos[currentImg - 1], currentContainer, activeContainer); }; var currentZindex = -1; var showImage = function(photoObject, currentContainer, activeContainer) { animating = true; // Make sure the new container is always on the background currentZindex--; // Set the background image of the new active container $("#headerimg" + activeContainer).css({ "background-image" : "url(images/" + photoObject.image + ")", "display" : "block", "z-index" : currentZindex }); // Hide the header text $("#headertxt").css({"display" : "none"}); // Set the new header text $("#firstline").html(photoObject.firstline); $("#secondline") .attr("href", photoObject.url) .html(photoObject.secondline); $("#pictureduri") .attr("href", photoObject.url) .html(photoObject.title); // Fade out the current container // and display the header text when animation is complete $("#headerimg" + currentContainer).fadeOut(function() { setTimeout(function() { $("#headertxt").css({"display" : "block"}); animating = false; }, 500); }); }; var stopAnimation = function() { // Change the background image to "play" $("#control").css({ "background-image" : "url(images/btn_play.png)" }); // Clear the interval clearInterval(interval); }; // We should statically set the first image navigate("next"); // Start playing the animation interval = setInterval(function() { navigate("next"); }, slideshowSpeed); }); superslidercss.zip Link to comment Share on other sites More sharing options...
Prestapascher Posted August 14, 2012 Share Posted August 14, 2012 Oula cela m'intéresse très fortement, si tu arrive à le finaliser je suis prêt à te donner une petite contrib!!!! Link to comment Share on other sites More sharing options...
kickflowers Posted August 16, 2012 Author Share Posted August 16, 2012 Bon je suis parti d'un autre script pour essayer d'arriver à ce que je veux. Pour le moment le slideshow sur le background fonctionne correctement. Reste plus qu'à mettre des boutons. superslidercss.zip Link to comment Share on other sites More sharing options...
Prestapascher Posted August 16, 2012 Share Posted August 16, 2012 Donc pour le moment ton script permet d'avoir un slideshow qui occupe toute la page (en background) mais pas de redirections c'est cela? Link to comment Share on other sites More sharing options...
kickflowers Posted August 16, 2012 Author Share Posted August 16, 2012 (edited) Oui c'est à peu près ça. En faite, je continues avec les deux scripts originaux superslidercss : le slideshow en arrière plan fonctionne mais il n'y a pas de bouton de navigation entre les images, ni de bouton de redirection. superslider : j'ai des problèmes de css et de positionnement car je 'narrive pas à le faire remplir toute la page. je vous met en zip la nouvelle version de superslider. ps : pour que superslider prenent en compte les images il faut copier les images dans un dossier image à la racine de prestashop... pas réussi à faire mieux sur ce coup là. Si je pouvais avoir de l'aide de pro pour ces deux ébauches de modules qui à mon avis pourraient être utiles ça serait super !!! superslider.zip Edited August 16, 2012 by kickflowers (see edit history) Link to comment Share on other sites More sharing options...
Prestapascher Posted August 16, 2012 Share Posted August 16, 2012 Je ne suis pas un pro mais je peux en parler à mon agence web voir si ils peuvent donner un coup de main. En effet un module de se genre serait très demandé je pense. Moi je ne sais même pas comment utiliser les scripts donc un peu compliqués lol Link to comment Share on other sites More sharing options...
Médéric Posted August 16, 2012 Share Posted August 16, 2012 Bonjour, J'en ai un en stock, je le nettoie un peu et reviens vers vous dans la journée Il permet l'administration des images / textes / liens... Link to comment Share on other sites More sharing options...
Prestapascher Posted August 16, 2012 Share Posted August 16, 2012 Cela serait vraiment génial ;-) Link to comment Share on other sites More sharing options...
Médéric Posted August 16, 2012 Share Posted August 16, 2012 (edited) J'ai créé un nouveau topic pour le module : http://www.prestashop.com/forums/topic/182693-module-slideshow-background-homepage/ J'espère que ça vous servira ! A+ Edited August 16, 2012 by Médéric (see edit history) Link to comment Share on other sites More sharing options...
kickflowers Posted August 17, 2012 Author Share Posted August 17, 2012 J'ai créé un nouveau topic pour le module : http://www.prestasho...round-homepage/ J'espère que ça vous servira ! A+ Whaou génial, je vais aller regarder ça même si j'aurai bien aimé comprendre mes erreurs sur mes deux essais de modules Link to comment Share on other sites More sharing options...
Prestapascher Posted August 17, 2012 Share Posted August 17, 2012 Dieu est grand!!!!!! haleluia lol Merci en tout cas et si tout fonctionne nikel, une donation comme promis ;-) 1 Link to comment Share on other sites More sharing options...
kickflowers Posted August 17, 2012 Author Share Posted August 17, 2012 (edited) Sur la base des informations de Médéric et de son module (disponible ici : http://www.prestasho...round-homepage/), j'ai quand même essayer d'améliorer mon essai de module. j'ai rajouté un hook dédié. Je vous met la version v0.2 en pièces jointes. Je n'ai pas d'option d'administration. Et j'ai encore plusieurs problèmes notamment j'aimerai attribuer un fond de couleur ou une autre image en dessous pour aller progressivement vers le footer. Le plus simple est de regarder le print ecran en pièce jointes. L'autre problème que je n'ai toujours pas résolu à régler est : Pourquoi mon script pioche dans un dossier images à la racine de Prestashop et non pas dans un dossier image dans le module.... ? Enfin, le dernier problème, comment le faire s'afficher sur toutes les pages .... Si vous avez des suggestions, je suis preneur. superslider.zip Edited August 17, 2012 by kickflowers (see edit history) Link to comment Share on other sites More sharing options...
kickflowers Posted August 21, 2012 Author Share Posted August 21, 2012 Pas de retour ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now