Foros del Web » Programando para Internet » Jquery »

Multiscroll

Estas en el tema de Multiscroll en el foro de Jquery en Foros del Web. Hola estoy haciendo mi web con multiscroll y quisiera saber como hago para añadir un tercer div en cada uno de los slider. Como en ...
  #1 (permalink)  
Antiguo 28/05/2014, 12:14
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Multiscroll

Hola estoy haciendo mi web con multiscroll y quisiera saber como hago para añadir un tercer div en cada uno de los slider. Como en el ejemplo donde pone RONAN MEROThttp://wandaprint.com/home

Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.  
  4. <head>
  5.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  6.     <title>multiscroll.js - split multi-scrolling pages plugin</title>
  7.     <meta name="author" content="Alvaro Trigo Lopez" />
  8.     <meta name="description" content="multiscroll plugin by Alvaro Trigo. Create divided multi-scrolling pages with two splited vertical layouts or panels." />
  9.     <meta name="keywords"  content="multiscroll,jquery,alvaro,trigo,plugin,divided,splitscreen,screen,panels,layouts,vertical,split,splited" />
  10.     <meta name="Resource-type" content="Document" />
  11.  
  12.    
  13.     <link rel="stylesheet" type="text/css" href="../jquery.multiscroll.css" />     
  14.     <link rel="stylesheet" type="text/css" href="examples.css" />      
  15.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  16.     <script type="text/javascript" src="../vendors/jquery.easings.min.js"></script>
  17.     <script type="text/javascript" src="../jquery.multiscroll.js"></script>
  18.  
  19.     <script type="text/javascript">
  20.      $(document).ready(function() {
  21.             $('#myContainer').multiscroll({
  22.                 sectionsColor: ['#C63D0F', '#1BBC9B', '#7E8F7C'],
  23.                 anchors: ['first', 'second', 'third'],
  24.                 menu: '#menu',
  25.                 css3: true,
  26.                 paddingTop: '70px',
  27.                 paddingBottom: '70px'
  28.             });
  29.         });
  30.     </script>
  31.  
  32.  
  33.     <style>
  34.     h1{
  35.         color: #fff;
  36.     }
  37.    
  38.     /* Fixed header and footer.
  39.     * --------------------------------------- */
  40.     #header, #footer{
  41.         position:fixed;
  42.         height: 50px;
  43.         display:block;
  44.         width: 100%;
  45.         z-index:9;
  46.         text-align:center;
  47.         padding: 20px 0 0 0;
  48.         src: url(webfontkit-20130325-045916/stop-webfont.ttf);
  49.         background-color: #FF0000;
  50.         font-family: StopD;
  51.         color: #FFF;
  52.         font-size: 36px;
  53.     }
  54.    
  55.     #header{
  56.         top:0px;
  57.     }
  58.     #footer{
  59.         bottom:0px;
  60.     }
  61.     </style>
  62. </head>
  63. <body>
  64. <div id="header">ELECTRODISEÑO</div>
  65. <div id="footer">Footer</div>
  66.  
  67.  
  68. <ul id="menu">
  69.     <li data-menuanchor="first"><a href="#first">Inicio</a></li>
  70.     <li data-menuanchor="second"><a href="#second">Second slide</a></li>
  71.     <li data-menuanchor="third"><a href="#third">Third slide</a></li>
  72. </ul>
  73.  
  74. <div id="myContainer">
  75.  
  76.     <div class="ms-left">
  77.         <div class="ms-section" id="left1">
  78.         <img src="http://www.forosdelweb.com/../imagenes_menu/FOTO1.png" width="100%" height="100%"> </div>
  79.  
  80.         <div class="ms-section" id="left2">
  81.             <h1>Left 2 </h1>
  82.         </div>
  83.  
  84.         <div class="ms-section" id="left3">
  85.             <h1>Left 3</h1>
  86.         </div>
  87.     </div>
  88.    
  89.     <div class="ms-right">
  90.         <div class="ms-section" id="right1">
  91.         <img src="http://www.forosdelweb.com/../imagenes_menu/FOTO2.png" width="100%" height="100%">
  92.         </div>
  93.         <div class="ms-section" id="right2">
  94.             <h1>Right 2</h1>
  95.         </div>
  96.         <div class="ms-section" id="right3">
  97.             <h1>Right 3</h1>
  98.         </div>
  99.     </div> 
  100. </div>
  101.  
  102. </body>
  103. </html>

Gracias y un saludo
  #2 (permalink)  
Antiguo 29/05/2014, 01:14
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

No sé si me he explicado bien.
  #3 (permalink)  
Antiguo 29/05/2014, 09:34
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Por favor quería preguntaros aparte si puedo en las secciones hacer una presentacion de slider ?

Quiero decir que por ejemplo en la sección de Catálogo de Productos de mi web hacer que al pulsar en iconos de flechas salgan la fotos del catálogo. Dejo mi web por si quereis echarle un vistazo.

http://www.xn--electrodiseo-khb.es/
Gracias

Última edición por satjaen; 29/05/2014 a las 16:34
  #4 (permalink)  
Antiguo 30/05/2014, 05:40
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Por favor nadie me puede ayudar ?

Me explico:

Tengo un multiscroll hecho en mi página web y quería por ejemplo en la sección de Catálogo de Productos poder meter mas fotos de dicho catálogo y no solo una como tengo ahora mismo. Una cosa así como en esta página http://wandaprint.com/home donde salen unos puntos en el lado derecho de la pantalla y vas viendo fotos. Mi página web es www.electrodiseño.es
Gracias

Última edición por satjaen; 30/05/2014 a las 06:00
  #5 (permalink)  
Antiguo 30/05/2014, 09:55
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Se que tengo que hacerlo en el archivo js lo pongo por si alguien me pude ayudar.

jquery.multiscroll.js

Código Javascript:
Ver original
  1. /**
  2.  * multiscroll.js 0.0.9 Beta
  3.  * https://github.com/alvarotrigo/multiscroll.js
  4.  * MIT licensed
  5.  *
  6.  * Copyright (C) 2013 alvarotrigo.com - A project by Alvaro Trigo
  7.  */
  8.  
  9. (function($) {
  10.     $.fn.multiscroll = function(options) {
  11.         // Create some defaults, extending them with any options that were provided
  12.         options = $.extend({
  13.             'verticalCentered' : true,
  14.             'scrollingSpeed': 700,
  15.             'easing': 'easeInQuart',
  16.             'menu': false,
  17.             'sectionsColor': [],
  18.             'anchors':[],
  19.             'navigation': false,
  20.             'navigationPosition': 'right',
  21.             'navigationColor': '#000',
  22.             'navigationTooltips': [],
  23.             'loopBottom': false,
  24.             'loopTop': false,
  25.             'css3': false,
  26.             'paddingTop': 0,
  27.             'paddingBottom': 0,
  28.             'fixedElements': null,
  29.             'normalScrollElements': null,
  30.             'keyboardScrolling': true,
  31.             'touchSensitivity': 5,
  32.  
  33.             //events
  34.             'afterLoad': null,
  35.             'onLeave': null,
  36.             'afterRender': null,
  37.             'afterResize': null
  38.         }, options);       
  39.        
  40.  
  41.         //Defines the delay to take place before being able to scroll to the next section
  42.         //BE CAREFUL! Not recommened to change it under 400 for a good behavior in laptops and
  43.         //Apple devices (laptops, mouses...)
  44.         var scrollDelay = 600;
  45.  
  46.         var numberSections = $('.ms-left').find('.ms-section').length;
  47.         var isMoving = false;
  48.         var nav;
  49.         var windowHeight = $(window).height();
  50.  
  51.  
  52.         addMouseWheelHandler();
  53.         addTouchHandler();
  54.  
  55.         //if css3 is not supported, it will use jQuery animations
  56.         if(options.css3){
  57.             options.css3 = support3d();
  58.         }
  59.  
  60.         $('html, body').css({
  61.             'overflow' : 'hidden',
  62.             'height' : '100%'
  63.         });
  64.  
  65.         //creating the navigation dots
  66.         if (options.navigation) {
  67.             $('body').append('<div id="multiscroll-nav"><ul></ul></div>');
  68.             nav = $('#multiscroll-nav');
  69.  
  70.             nav.css('color', options.navigationColor);
  71.             nav.addClass(options.navigationPosition);
  72.         }
  73.        
  74.         $('.ms-right, .ms-left').css({
  75.             'width': '50%',
  76.             'position': 'absolute',
  77.             'height': '100%'
  78.         });
  79.  
  80.         $('.ms-right').css({
  81.             'right': '0.1px', //http://stackoverflow.com/questions/23675457/chrome-and-opera-creating-small-padding-when-using-displaytable
  82.             'top': '0'
  83.         });
  84.  
  85.         $('.ms-left').css({
  86.             'left': '0',
  87.             'top': '0'
  88.         });
  89.  
  90.  
  91.         $('.ms-left .ms-section, .ms-right .ms-section').each(function(){
  92.             var sectionIndex = $(this).index();
  93.  
  94.             if(options.paddingTop || options.paddingBottom){
  95.                 $(this).css('padding', options.paddingTop  + ' 0 ' + options.paddingBottom + ' 0');
  96.             }
  97.            
  98.             if (typeof options.sectionsColor[sectionIndex] !==  'undefined') {
  99.                 $(this).css('background-color', options.sectionsColor[sectionIndex]);
  100.             }
  101.  
  102.             if (typeof options.anchors[sectionIndex] !== 'undefined') {
  103.                 $(this).attr('data-anchor', options.anchors[sectionIndex]);
  104.             }  
  105.  
  106.             if(options.verticalCentered){
  107.                 addTableClass($(this));
  108.             }
  109.  
  110.             //only for the left panel
  111.             if($(this).closest('.ms-left').length && options.navigation) {
  112.                 var link = '';
  113.                 if(options.anchors.length){
  114.                     link = options.anchors[sectionIndex];
  115.                 }
  116.                 var tooltip = options.navigationTooltips[sectionIndex];
  117.                 if(typeof tooltip === 'undefined'){
  118.                     tooltip = '';
  119.                 }
  120.                 if (options.navigation) {
  121.                     nav.find('ul').append('<li data-tooltip="' + tooltip + '"><a href="#' + link + '"><span></span></a></li>');
  122.                 }
  123.             }
  124.         });
  125.  
  126.         //inverting the right panel
  127.         $('.ms-right').html( $('.ms-right').find('.ms-section').get().reverse());
  128.  
  129.         $('.ms-left .ms-section, .ms-right .ms-section').each(function(){
  130.             var sectionIndex = $(this).index();
  131.  
  132.             $(this).css({
  133.                 'height': '100%'
  134.             });
  135.            
  136.    
  137.             if(!sectionIndex && options.navigation ){
  138.                 //activating the navigation bullet
  139.                 nav.find('li').eq(sectionIndex).find('a').addClass('active');
  140.             }
  141.         }).promise().done(function(){
  142.  
  143.             //if no active section is defined, the 1st one will be the default one
  144.             if(!$('.ms-left .ms-section.active').length){
  145.                 $('.ms-right').find('.ms-section').last().addClass('active');
  146.                 $('.ms-left').find('.ms-section').first().addClass('active');
  147.             }
  148.  
  149.             $.isFunction( options.afterRender ) && options.afterRender.call( this);
  150.  
  151.             //scrolling to the defined active section and adjusting right and left panels
  152.             silentScroll();
  153.  
  154.             $(window).on('load', function() {
  155.                 scrollToAnchor();  
  156.             });
  157.         });
  158.  
  159.        
  160.         //detecting any change on the URL to scroll to the given anchor link
  161.         //(a way to detect back history button as we play with the hashes on the URL)
  162.         $(window).on('hashchange',function(){
  163.             var value =  window.location.hash.replace('#', '');
  164.             var sectionAnchor = value;
  165.  
  166.             var section = $('.ms-left').find('[data-anchor="'+sectionAnchor+'"]');
  167.            
  168.             var isFirstScrollMove = (typeof lastScrolledDestiny === 'undefined' );
  169.  
  170.             if (isFirstScrollMove || sectionAnchor !== lastScrolledDestiny){
  171.                 scrollPage(section);
  172.             }
  173.         });
  174.        
  175.  
  176.         /**
  177.          * Sliding with arrow keys, both, vertical and horizontal
  178.          */
  179.         $(document).keydown(function(e) {
  180.             //Moving the main page with the keyboard arrows if keyboard scrolling is enabled
  181.             if (options.keyboardScrolling && !isMoving) {
  182.                 switch (e.which) {
  183.                     //up
  184.                     case 38:
  185.                     case 33:
  186.                         $.fn.multiscroll.moveSectionUp();
  187.                         break;
  188.  
  189.                     //down
  190.                     case 40:
  191.                     case 34:
  192.                         $.fn.multiscroll.moveSectionDown();
  193.                         break;
  194.            
  195.                     default:
  196.                         return; // exit this handler for other keys
  197.                 }
  198.             }
  199.         });
  200.  
  201.  
  202.         /**
  203.          * Disabling any action when pressing of the mouse wheel (Chrome, IE, Opera, Safari)
  204.          */
  205.         $(document).mousedown(function(e) {
  206.             if(e.button == 1){
  207.                 e.preventDefault();
  208.                 return false;
  209.             }
  210.         });
  211.  
  212.         //navigation action
  213.         $(document).on('click', '#multiscroll-nav a', function(e){
  214.             e.preventDefault();
  215.             var index = $(this).parent().index();
  216.             scrollPage($('.ms-left .ms-section').eq(index));
  217.         });


Es mas largo si hace falta pongo mas
  #6 (permalink)  
Antiguo 30/05/2014, 10:01
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Continuacion....

Código Javascript:
Ver original
  1. //navigation tooltips
  2.         $(document).on({
  3.             mouseenter: function(){
  4.                 var tooltip = $(this).data('tooltip');
  5.                 $('<div class="multiscroll-tooltip ' + options.navigationPosition +'">' + tooltip + '</div>').hide().appendTo($(this)).fadeIn(200);
  6.             },
  7.             mouseleave: function(){
  8.                 $(this).find('.multiscroll-tooltip').fadeOut().remove();
  9.             }
  10.         }, '#multiscroll-nav li');
  11.  
  12.  
  13.         if(options.normalScrollElements){
  14.             $(document).on('mouseover', options.normalScrollElements, function () {
  15.                 $.fn.multiscroll.setMouseWheelScrolling(false);
  16.             });
  17.            
  18.             $(document).on('mouseout', options.normalScrollElements, function(){
  19.                 $.fn.multiscroll.setMouseWheelScrolling(true);
  20.             });
  21.         }
  22.  
  23.  
  24.         //when resizing the site, we adjust the heights of the sections
  25.         $(window).resize(function() {
  26.             doneResizing();
  27.         });
  28.  
  29.         /**
  30.          * When resizing is finished, we adjust the slides sizes and positions
  31.          */
  32.         function doneResizing() {
  33.             windowHeight = $(window).height();
  34.  
  35.             silentScroll();
  36.             $.isFunction( options.afterResize ) && options.afterResize.call( this);
  37.         }
  38.  
  39.         function silentScroll(){
  40.             //moving the right section to the bottom
  41.             if(options.css3){
  42.                 transformContainer($('.ms-left'), 'translate3d(0px, -' + $('.ms-left').find('.ms-section.active').position().top + 'px, 0px)', false);
  43.                 transformContainer($('.ms-right'), 'translate3d(0px, -' + $('.ms-right').find('.ms-section.active').position().top + 'px, 0px)', false);
  44.             }else{
  45.                 $('.ms-left').css('top', -$('.ms-left').find('.ms-section.active').position().top );
  46.                 $('.ms-right').css('top', -$('.ms-right').find('.ms-section.active').position().top );
  47.             }
  48.         }
  49.  
  50.         $.fn.multiscroll.moveSectionUp = function(){
  51.             var prev = $('.ms-left .ms-section.active').prev('.ms-section');
  52.  
  53.             if(!prev.length && options.loopTop){
  54.                 prev = $('.ms-left .ms-section').last();
  55.             }
  56.  
  57.             if (prev.length) {
  58.                 scrollPage(prev);
  59.             }
  60.         };
  61.  
  62.         $.fn.multiscroll.moveSectionDown = function (){
  63.             var next = $('.ms-left .ms-section.active').next('.ms-section');
  64.  
  65.             if(!next.length && options.loopBottom ){
  66.                 next = $('.ms-left .ms-section').first();
  67.             }
  68.  
  69.             if(next.length){
  70.                 scrollPage(next);
  71.             }
  72.         };
  73.  
  74.         $.fn.multiscroll.moveTo = function (section){
  75.             var destiny = '';
  76.            
  77.             if(isNaN(section)){
  78.                 destiny = $('.ms-left [data-anchor="'+section+'"]');
  79.             }else{
  80.                 destiny = $('.ms-left .ms-section').eq( (section -1) );
  81.             }
  82.            
  83.             scrollPage(destiny);
  84.         };
  85.  
  86.         function scrollPage(leftDestination){
  87.             var leftDestinationIndex = leftDestination.index();
  88.             var rightDestination = $('.ms-right').find('.ms-section').eq( numberSections -1 - leftDestinationIndex);
  89.             var rightDestinationIndex = numberSections - 1 - leftDestinationIndex;
  90.             var anchorLink  = leftDestination.data('anchor');
  91.             var activeSection = $('.ms-left .ms-section.active');
  92.             var leavingSection = activeSection.index() + 1;
  93.             var yMovement = getYmovement(leftDestination);
  94.  
  95.             //preventing from activating the MouseWheelHandler event
  96.             //more than once if the page is scrolling
  97.             isMoving = true;
  98.  
  99.             setURLHash(anchorLink);
  100.  
  101.             var topPos = {
  102.                 'left' : leftDestination.position().top,
  103.                 'right': rightDestination.position().top
  104.             };
  105.  
  106.             rightDestination.addClass('active').siblings().removeClass('active');
  107.             leftDestination.addClass('active').siblings().removeClass('active');
  108.  
  109.             // Use CSS3 translate functionality or...
  110.             if (options.css3){             
  111.                 //callback (onLeave)
  112.                 $.isFunction(options.onLeave) && options.onLeave.call(this, leavingSection, (leftDestinationIndex + 1), yMovement);
  113.  
  114.                 var translate3dLeft = 'translate3d(0px, -' + topPos['left'] + 'px, 0px)';
  115.                 var translate3dRight = 'translate3d(0px, -' + topPos['right'] + 'px, 0px)';
  116.  
  117.                 transformContainer($('.ms-left'), translate3dLeft, true);
  118.                 transformContainer($('.ms-right'), translate3dRight, true);
  119.  
  120.                 setTimeout(function () {
  121.                     //callback (afterLoad)
  122.                     $.isFunction(options.afterLoad) && options.afterLoad.call(this, anchorLink, (leftDestinationIndex + 1));
  123.  
  124.                     setTimeout(function () {
  125.                         isMoving = false;
  126.                     }, scrollDelay);
  127.                 }, options.scrollingSpeed);
  128.             }else{
  129.                 //callback (onLeave)
  130.                 $.isFunction(options.onLeave) && options.onLeave.call(this, leavingSection, (leftDestinationIndex + 1), yMovement);
  131.  
  132.                 $('.ms-left').animate({
  133.                     'top': -topPos['left']
  134.                 }, options.scrollingSpeed, options.easing, function(){
  135.                     $.isFunction(options.afterLoad) && options.afterLoad.call(this, anchorLink, (leftDestinationIndex + 1));
  136.  
  137.                     setTimeout(function () {
  138.                         isMoving = false;
  139.                     }, scrollDelay);
  140.                 });
  141.  
  142.                 $('.ms-right').animate({
  143.                     'top': -topPos['right']
  144.                 }, options.scrollingSpeed, options.easing);
  145.             }
  146.            
  147.             //flag to avoid callingn `scrollPage()` twice in case of using anchor links
  148.             lastScrolledDestiny = anchorLink;
  149.  
  150.             activateMenuElement(anchorLink);
  151.             activateNavDots(anchorLink, leftDestinationIndex);
  152.         }
  153.  
  154.         /**
  155.         * Removes the auto scrolling action fired by the mouse wheel and tackpad.
  156.         * After this function is called, the mousewheel and trackpad movements won't scroll through sections.
  157.         */
  158.         function removeMouseWheelHandler(){
  159.             if (document.addEventListener) {
  160.                 document.removeEventListener('mousewheel', MouseWheelHandler, false); //IE9, Chrome, Safari, Oper
  161.                 document.removeEventListener('wheel', MouseWheelHandler, false); //Firefox
  162.             } else {
  163.                 document.detachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8
  164.             }
  165.         }
  166.  
  167.         /**
  168.         * Adds the auto scrolling action for the mouse wheel and tackpad.
  169.         * After this function is called, the mousewheel and trackpad movements will scroll through sections
  170.         */
  171.         function addMouseWheelHandler(){
  172.             if (document.addEventListener) {
  173.                 document.addEventListener("mousewheel", MouseWheelHandler, false); //IE9, Chrome, Safari, Oper
  174.                 document.addEventListener("wheel", MouseWheelHandler, false); //Firefox
  175.             } else {
  176.                 document.attachEvent("onmousewheel", MouseWheelHandler); //IE 6/7/8
  177.             }
  178.         }
  179.  
  180.         /**
  181.          * Detecting mousewheel scrolling
  182.          *
  183.          * http://blogs.sitepointstatic.com/examples/tech/mouse-wheel/index.html
  184.          * http://www.sitepoint.com/html5-javascript-mouse-wheel/
  185.          */
  186.         function MouseWheelHandler(e) {
  187.             // cross-browser wheel delta
  188.             e = window.event || e;
  189.             var delta = Math.max(-1, Math.min(1,
  190.                     (e.wheelDelta || -e.deltaY || -e.detail)));
  191.  
  192.             if (!isMoving) { //if theres any #
  193.  
  194.                 //scrolling down?
  195.                 if (delta < 0) {
  196.                     $.fn.multiscroll.moveSectionDown();
  197.                 }
  198.  
  199.                 //scrolling up?
  200.                 else {
  201.                     $.fn.multiscroll.moveSectionUp();
  202.                 }
  203.             }
  204.        
  205.  
  206.             return false;
  207.         }
  208.  
  209.     /**
  210.         * Adds a css3 transform property to the container class with or without animation depending on the animated param.
  211.         */
  212.         function transformContainer(container, translate3d, animated){
  213.             container.toggleClass('ms-easing', animated);
  214.            
  215.             container.css(getTransforms(translate3d));
  216.         }
  #7 (permalink)  
Antiguo 30/05/2014, 10:01
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Continuación...

Código Javascript:
Ver original
  1. /**
  2.         * Returns the transform styles for all browsers
  3.         */
  4.         function getTransforms(translate3d){
  5.             return {
  6.                 '-webkit-transform': translate3d,
  7.                 '-moz-transform': translate3d,
  8.                 '-ms-transform':translate3d,
  9.                 'transform': translate3d
  10.             };
  11.         }
  12.  
  13.         /**
  14.          * Activating the website navigation dots according to the given slide name.
  15.          */
  16.         function activateNavDots(name, sectionIndex){
  17.             if(options.navigation){
  18.                 $('#multiscroll-nav').find('.active').removeClass('active');
  19.                 if(name){
  20.                     $('#multiscroll-nav').find('a[href="#' + name + '"]').addClass('active');
  21.                 }else{
  22.                     $('#multiscroll-nav').find('li').eq(sectionIndex).find('a').addClass('active');
  23.                 }
  24.             }
  25.         }
  26.  
  27.         /**
  28.          * Activating the website main menu elements according to the given slide name.
  29.          */
  30.         function activateMenuElement(name){
  31.             if(options.menu){
  32.                 $(options.menu).find('.active').removeClass('active');
  33.                 $(options.menu).find('[data-menuanchor="'+name+'"]').addClass('active');
  34.             }
  35.         }
  36.  
  37.         /**
  38.         * Retuns `up` or `down` depending on the scrolling movement to reach its destination
  39.         * from the current section.
  40.         */
  41.         function getYmovement(destiny){
  42.             var fromIndex = $('.ms-left .ms-section.active').index();
  43.             var toIndex = destiny.index();
  44.  
  45.             if(fromIndex > toIndex){
  46.                 return 'up';
  47.             }
  48.             return 'down';
  49.         }  
  50.  
  51.  
  52.         /**
  53.         * Sets the URL hash for a section with slides
  54.         */
  55.         function setURLHash(anchorLink){
  56.             if(options.anchors.length){
  57.                 location.hash = anchorLink;
  58.             }
  59.         }
  60.  
  61.  
  62.         /**
  63.         * Checks for translate3d support
  64.         * @return boolean
  65.         * http://stackoverflow.com/questions/5661671/detecting-transform-translate3d-support
  66.         */
  67.         function support3d() {
  68.             var el = document.createElement('p'),
  69.                 has3d,
  70.                 transforms = {
  71.                     'webkitTransform':'-webkit-transform',
  72.                     'OTransform':'-o-transform',
  73.                     'msTransform':'-ms-transform',
  74.                     'MozTransform':'-moz-transform',
  75.                     'transform':'transform'
  76.                 };
  77.  
  78.             // Add it to the body to get the computed style.
  79.             document.body.insertBefore(el, null);
  80.  
  81.             for (var t in transforms) {
  82.                 if (el.style[t] !== undefined) {
  83.                     el.style[t] = "translate3d(1px,1px,1px)";
  84.                     has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);
  85.                 }
  86.             }
  87.            
  88.             document.body.removeChild(el);
  89.  
  90.             return (has3d !== undefined && has3d.length > 0 && has3d !== "none");
  91.         }
  92.  
  93.         /**
  94.         * Wraps an element in order to center it vertically by using a class style.
  95.         */
  96.         function addTableClass(element){
  97.             element.addClass('ms-table').wrapInner('<div class="ms-tableCell" style="height: ' + getTableHeight(element) + 'px" />');
  98.         }
  99.  
  100.         /**
  101.         * Gets the height of the section after removing the paddings.
  102.         */
  103.         function getTableHeight(section){
  104.             var sectionHeight = windowHeight;
  105.  
  106.             if(options.paddingTop || options.paddingBottom){           
  107.                 var paddings = parseInt(section.css('padding-top')) + parseInt(section.css('padding-bottom'));
  108.                 sectionHeight = (windowHeight - paddings);
  109.             }
  110.  
  111.             return sectionHeight;
  112.         }
  113.  
  114.  
  115.         /**
  116.         * Scrolls the page to the existent anchor in the URL
  117.         */
  118.         function scrollToAnchor(){
  119.             //getting the anchor link in the URL and deleting the `#`
  120.             var sectionAnchor =  window.location.hash.replace('#', '');
  121.             var section = $('.ms-left .ms-section[data-anchor="'+sectionAnchor+'"]');
  122.  
  123.             if(sectionAnchor.length){  //if theres any #   
  124.                 scrollPage(section);
  125.             }
  126.         }
  127.  
  128.         /**
  129.         * Adds or remove the possiblity of scrolling through sections by using the keyboard arrow keys
  130.         */
  131.         $.fn.multiscroll.setKeyboardScrolling = function (value){
  132.             options.keyboardScrolling = value;
  133.         };
  134.  
  135.         /**
  136.         * Adds or remove the possiblity of scrolling through sections by using the mouse wheel or the trackpad.
  137.         */
  138.         $.fn.multiscroll.setMouseWheelScrolling = function (value){
  139.             if(value){
  140.                 addMouseWheelHandler();
  141.             }else{
  142.                 removeMouseWheelHandler();
  143.             }
  144.         };
  145.  
  146.         /**
  147.         * Defines the scrolling speed
  148.         */
  149.         $.fn.multiscroll.setScrollingSpeed = function(value){
  150.            options.scrollingSpeed = value;
  151.         };
  152.  
  153.  
  154.  
  155.         var touchStartY = 0;
  156.         var touchStartX = 0;
  157.         var touchEndY = 0;
  158.         var touchEndX = 0;
  159.    
  160.         /* Detecting touch events
  161.        
  162.         * As we are changing the top property of the page on scrolling, we can not use the traditional way to detect it.
  163.         * This way, the touchstart and the touch moves shows an small difference between them which is the
  164.         * used one to determine the direction.
  165.         */     
  166.         function touchMoveHandler(event){
  167.             var e = event.originalEvent;
  168.  
  169.             //preventing the easing on iOS devices
  170.             event.preventDefault();
  171.  
  172.             var activeSection = $('.ms-left .ms-section.active');
  173.  
  174.             if (!isMoving) { //if theres any #
  175.                 var touchEvents = getEventsPage(e);
  176.                 touchEndY = touchEvents['y'];
  177.                 touchEndX = touchEvents['x'];
  178.                                    
  179.  
  180.                 //is the movement greater than the minimum resistance to scroll?
  181.                 if (Math.abs(touchStartY - touchEndY) > ($(window).height() / 100 * options.touchSensitivity)) {
  182.  
  183.                     if (touchStartY > touchEndY) {
  184.                         $.fn.multiscroll.moveSectionDown();
  185.  
  186.                     } else if (touchEndY > touchStartY) {
  187.                         $.fn.multiscroll.moveSectionUp();
  188.                     }
  189.                 }
  190.             }
  191.         }
  192.  
  193.  
  194.         /**
  195.         * Handler to get he coordinates of the starting touch
  196.         */
  197.         function touchStartHandler(event){
  198.             var e = event.originalEvent;
  199.             var touchEvents = getEventsPage(e);
  200.             touchStartY = touchEvents['y'];
  201.             touchStartX = touchEvents['x'];
  202.         }
  203.  
  204.  
  205.         /**
  206.         * Adds the possibility to auto scroll through sections on touch devices.
  207.         */
  208.         function addTouchHandler(){
  209.             $(document).off('touchstart MSPointerDown').on('touchstart MSPointerDown', touchStartHandler);
  210.             $(document).off('touchmove MSPointerMove').on('touchmove MSPointerMove', touchMoveHandler);
  211.         }
  212.        
  213.         /**
  214.         * Removes the auto scrolling for touch devices.
  215.         */
  216.         function removeTouchHandler(){
  217.             $(document).off('touchstart MSPointerDown');
  218.             $(document).off('touchmove MSPointerMove');
  219.         }
  220.  
  221.         /**
  222.         * Gets the pageX and pageY properties depending on the browser.
  223.         * https://github.com/alvarotrigo/fullPage.js/issues/194#issuecomment-34069854
  224.         */
  225.         function getEventsPage(e){
  226.             var events = new Array();
  227.             if (window.navigator.msPointerEnabled){
  228.                 events['y'] = e.pageY;
  229.                 events['x'] = e.pageX;
  230.             }else{
  231.                 events['y'] = e.touches[0].pageY;
  232.                 events['x'] =  e.touches[0].pageX;
  233.             }
  234.  
  235.             return events;
  236.         }
  237.  
  238.     }; 
  239. })(jQuery);
  #8 (permalink)  
Antiguo 30/05/2014, 10:03
Avatar de satjaen  
Fecha de Ingreso: septiembre-2012
Ubicación: Jaén (Andalucía)
Mensajes: 893
Antigüedad: 11 años, 8 meses
Puntos: 10
Respuesta: Multiscroll

Y el index.html

Código HTML:
Ver original
  1. <!DOCTYPE html>
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <link rel="shortcut icon" href="favicon (3).ico" />
  4. <meta name="google-site-verification" content="ATj-yVLdZKC3CNF8OArdBk2pWoqXeNXdXkuFp8T2rYo" />
  5.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  6.     <title>ELECTRODISEÑO</title>
  7.     <meta name="Resource-type" content="Document" />
  8.     <link rel="stylesheet" type="text/css" href="jquery.multiscroll.css" />    
  9.     <link rel="stylesheet" type="text/css" href="examples.css" />      
  10.     <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
  11.     <script type="text/javascript" src="vendors/jquery.easings.min.js"></script>
  12.     <script type="text/javascript" src="jquery.multiscroll.js"></script>
  13.  
  14.     <script type="text/javascript">
  15.      $(document).ready(function() {
  16.             $('#myContainer').multiscroll({
  17.                 sectionsColor: ['#C63D0F', '#FF0000', '#7E8F7C', '#FF0000', '#FF0000'],
  18.                 anchors: ['first', 'second', 'third' , 'fourth' , 'five'],
  19.                 menu: '#menu',
  20.                 css3: true,
  21.                 paddingTop: '70px',
  22.                 paddingBottom: '70px'
  23.             });
  24.         });
  25.     </script>
  26.  
  27.  
  28.     <style>
  29.     h1{
  30.         color: #fff;
  31.     }
  32.    
  33.     /* Fixed header and footer.
  34.     * --------------------------------------- */
  35.     #header{
  36.         position:fixed;
  37.         height: 50px;
  38.         display:block;
  39.         width: 100%;
  40.         z-index:9;
  41.         text-align:center;
  42.         padding: 45px 0 0 0;
  43.         src: url(webfontkit-20130325-045916/stop-webfont.ttf);
  44.         background-color: #FF0000;
  45.         font-family: StopD;
  46.         color: #FFF;
  47.         font-size: 36px;
  48.     }
  49.     #footer{
  50.         color: #FFF;
  51.         font-size: 12px;
  52.         position:fixed;
  53.         height: 50px;
  54.         display:block;
  55.         width: 100%;
  56.         z-index:9;
  57.         text-align:center;
  58.         padding: 20px 0 0 0;
  59.         background-color: #FF0000; 
  60.     }
  61.    
  62.     #header{
  63.         top:0px;
  64.     }
  65.     #footer{
  66.         bottom:0px;
  67.     }
  68.    
  69.     /* CSS Document */
  70. .slider{
  71.     width:1000px; /* width en px de la imagenes  */
  72.     height:300px; /* height en px de la imagenes  */
  73.     overflow:hidden; /* no tocar */
  74.     position:relative; /* no tocar */
  75.     padding:0px; /* no tocar */
  76.     margin-top: 0px;
  77.     margin-right: auto;
  78.     margin-bottom: 0px;
  79.     margin-left: auto;
  80. }
  81.  
  82.     </style>
  83. </head>
  84. <div id="header">ELECTRODISEÑO</div>
  85. <div id="footer">
  86. 2014 © ELECTRODISEÑO | No somos Servicio técnico oficial de todas las marcas anunciadas en esta web. | Las marcas pertenecen a sus dueños legales. |
  87.  <a href="avisolegal.html" target="new">Aviso legal</a> |
  88.   <a href="https://maps.google.es/maps?hl=es&q=Electrodiseño,+jaen&ie=UTF8&geocode=Fe3jUgIdAxPE_w&split=0&hnear=calle+EUROPA,+S/N,+jaen&iwloc=near&source=embed" target="new"  >Localización</a> | <a href='envia_contacto.php' target="_blank">Contacto</a>
  89. </div>
  90.  
  91.  
  92. <ul id="menu">
  93.     <li data-menuanchor="first"><a href="#first">Inicio</a></li>
  94.     <li data-menuanchor="second"><a href="#second">Marcas</a></li>
  95.     <li data-menuanchor="third"><a href="#third">Servicio Oficial</a></li>
  96.     <li data-menuanchor="fourth"><a href="#fourth">Catálogo de Productos</a></li>
  97.     <li data-menuanchor="five"><a href="#five">Ofertas</a></li>
  98.      
  99. </ul>
  100.  
  101.  
  102. <div id="myContainer">
  103.  
  104.     <div class="ms-left">
  105.         <div class="ms-section" id="left1">
  106.         <img src="imgs/FOTO1.png" width="100%" height="100%"> </div>
  107.  
  108.         <div class="ms-section" id="left2">
  109.             <img src="imgs/FOTO3.png" width="100%" height="90%">
  110.         </div>
  111.  
  112.         <div class="ms-section" id="left3">
  113.             <img src="imgs/FOTO.1MARCAS.png" width="100%" height="100%">
  114.         </div>
  115.        
  116.        <div class="ms-section" id="left4">
  117.        <img src="imgs/Captura de pantalla 2014-05-29 a la(s) 17.12.28.png" width="100%" height="100%">
  118.        <img src="imgs/aire.png" width="100%" height="100%">
  119.            
  120.         </div>
  121.        
  122.          <div class="ms-section" id="left5">
  123.        <img src="imgs/aire.png" width="100%" height="90%">
  124.            
  125.         </div>
  126.     </div>
  127.    
  128.     <div class="ms-right">
  129.         <div class="ms-section" id="right1">
  130.         <img src="imgs/FOTO2.5.jpg" width="100%" height="100%">
  131.         </div>
  132.         <div class="ms-section" id="right2">
  133.             <img src="imgs/FOTO4.png" width="100%" height="90%">
  134.         </div>
  135.         <div class="ms-section" id="right3">
  136.             <img src="imgs/FOTO.2MARCAS.png" width="100%" height="100%">
  137.         </div>
  138.        
  139.         <div class="ms-section" id="right4">
  140.             <img src="imgs/Captura de pantalla 2014-05-29 a la(s) 17.13.27.png" width="100%" height="100%">
  141.             <img src="imgs/carga-superior.png" width="100%" height="100%">
  142.         </div>
  143.           <div class="ms-section" id="right5">
  144.             <img src="imgs/carga-superior.png" width="100%" height="90%">
  145.         </div>
  146.        
  147.     </div>
  148.  
  149. </div>
  150.  
  151.     </body>
  152. </html>

Etiquetas: Ninguno
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:18.