Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

lhyppolito

erro na função no ie!

Recommended Posts

olá

 

tenho um jquery rotativo em meu site!

ele funciona perfeitamente no firefox, mas no ie, ele nao reconheçe o mesmo tamanho definido!

 

peguei uma função como base...

function( $ ){

var defaults = {
	elements:'img',//elements selector (relative to view)
	itemSize:{
		height:124,
		width:300
	},
	view:null,//container of the elements, the one to fix the width.
	navigators:null,//selector to the elements to navigate the slideshow.
	navigationMode:'s',//sequential, random, localscroll
	speed:600,//speed of transition, 1 for no-animation
	wrappers:'simple',//simple,resize,crop,link
	circular:false,//should the slideshow rewind/advance on the extremes ?.
	easing:'linear',//easing equation
	axis:'x',//axis to displace the slideshow
	margin:true,//take margin in account?
	start:null, //force the scroll to start at some position element.
	setWidth:false//whether to calculate and set, the overall width of the slideshow.
};

 

quando eu defino o width e o height no fire pega a imagem apenas, mas no ie faz com que eu nao possa colocar mais nada!

e ao lado da imagem eu preciso colocar mais 3 divs!

gostaria de saber como faço para adicionar mais essas divs ao meu codigo!

 

agradeço desde ja!

att

Compartilhar este post


Link para o post
Compartilhar em outros sites

gostaria de saber como faço para adicionar mais essas divs ao meu codigo!

depende do restante do código.

 

depende de como foi escrito.

consulte a documentação, e debugue o teu script.

 

Veja se aparecem erros, guia:

http://www.wbruno.com.br/blog/2011/03/31/como-debugar-javascript-firefox-erros-comuns/

Compartilhar este post


Link para o post
Compartilhar em outros sites

agradeço a atenção willian bruno!

 

entao o css creio que esta certo!

 

funciona assim, ele contem uma imagem com texto do lado!

no fire fox, o widht e o height da função que enviei, identifica todas minhas divs!

ja no ie ele só fica a imagem e empurra as outras coisas pra baixo!

 

sera que tem outra forma de eu definir esse elemento?

 

elements:'img',//elements selector (relative to view)

itemSize:{

height:124,

width:300

},

 

 

qual parte do codigo você precisa pra verificar pora min?

 

att

Compartilhar este post


Link para o post
Compartilhar em outros sites

sera que tem outra forma de eu definir esse elemento?

impossivel que eu adivinhe.

 

pesquise no site de onde você baixou o script.

se tiver duvidas, poste aqui o link dele.

 

 

qual parte do codigo você precisa pra verificar pora min?

posso te ajudar, mas não vou fazer para você.

Compartilhar este post


Link para o post
Compartilhar em outros sites

esse plugin foi muito mal escrito.

 

vi o core dele, e ele não define a unidade de medida das dimensões da imagem. Portanto, faça você:

itemSize:{
height: '124px',
width: '300px'
},

oque você disse sobre imagem e div, não faz o menor sentido.

 

DIV é HTML, jQuery é javascript.

 

 

 

 

/**
* jQuery.ScrollShow - Scrolling Slideshow.
* Copyright (c) 2007 Ariel Flesler - aflesler(at)gmail(dot)com
* Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php).
* Date: 10/30/2007
* @author Ariel Flesler
* @version 0.7
*
* @id jQuery.fn.scrollShow
* @param {Object} settings Hash of settings (detailed below).
* @return {jQuery} Returns the same jQuery object, for chaining.
**/
(function( $ ){

var defaults = {
	elements:'img',//elements selector (relative to view)
	itemSize:{
		height:200,
		width:200
	},
	view:null,//container of the elements, the one to fix the width.
	navigators:null,//selector to the elements to navigate the slideshow.
	navigationMode:'s',//sequential, random, localscroll
	speed:600,//speed of transition, 1 for no-animation
	wrappers:'simple',//simple,resize,crop,link
	circular:false,//should the slideshow rewind/advance on the extremes ?.
	easing:'linear',//easing equation
	axis:'x',//axis to displace the slideshow
	margin:true,//take margin in account?
	start:null, //force the scroll to start at some position element.
	setWidth:false//whether to calculate and set, the overall width of the slideshow.
};

function wrap( $els, type, size ){//wrap the photos with several different wrappers.
	switch( type ){
		case 'crop': $els = $els.wrap('<div class="jq-ss-crop">').parent().css('overflow','hidden');					
		case 'resize': return $els.css( size );
		case 'simple': return $els.wrap('<div class="jq-ss-simple">').parent();
		case 'link': 
			if( $els.is('img') )
				return $els.wrap('<a target="_blank" class="jq-ss-link">').parent().each(function(){
					this.href = this.firstChild.src;
				});
		default: return $els;					
	}
};

$.fn.scrollShow = function( settings ){
	settings = $.extend( {}, defaults, settings );

	return this.each(function(){
		var 
			widget	  = this,
			$view	  = settings.view ? $(settings.view, this) : this,
			$elements = $(settings.elements, $view),
			limit	  = $elements.length,
			active	  = 0;

		$.each( settings.wrappers.split(/\s*,\s*/), function( i, wrapper ){
			$elements = wrap( $elements, wrapper, settings.itemSize );													 
		});			
		$elements.css( settings.itemSize );//ensure the outer elements have fixed size.

		if( !settings.navigators ){//this shouldn't get to happen
			settings.navigators = '';
			settings.navigationMode = 'r';
		}

		if( settings.navigators.constructor != Array )
			settings.navigators = [settings.navigators];

		$.each( settings.navigationMode.split(''), function( i, type ){
			switch( type.charAt(0) ){
				case 's'://sequential navigation
					$(settings.navigators[i],widget)
						.eq(0).bind('click', { dir: -1 }, sequential ).end()
						.eq(1).bind('click', { dir: +1 }, sequential );
				break;
				case 'r'://random navigation
					var $nav = $(settings.navigators[i] || $elements, widget),
						ratio = $elements.length / $nav.length;
					if( ratio === Infinity ) return;//no navigator found
					$nav.each(function( pos ){
						$(this).bind( 'click', { pos: Math.floor(ratio*pos) }, random );												  
					});
				break;
			}
		});				

		(function( $e, w ){					  
			var imgw = ($e.width() + attrs('margin') + attrs('padding') + attr('border'));

			do w -= imgw;
			while( w > 0 && limit-- );//find the last element we can scroll To.

			if( !settings.setWidth ) return;

			do{
				$e = $e.parent();
				if( $e[0] == $view[0] )
					return;
			}while( $e.length > 1 );
			$e.width( imgw * $elements.length  );//if there's a container for the elements, calculate it's width.

		})( $elements, $view.width() );

		if( settings.start != null )
			random( settings.start );

		function attrs( name ){
			return attr(name+'Left') + attr(name+'Right');
		};
		function attr( name ){
			return parseInt($elements.css(name)) || 0;	
		};

		function sequential( event ){
			event.data.pos = active + event.data.dir;
			return random( event );
		};

		function random( event ){
			var pos = typeof event == 'number' ? event : event.data.pos;
			if( pos < 0 )
				pos = active == 0 && settings.circular ? limit : 0;
			else if( pos > limit )
				pos = active == limit && settings.circular ? 0 : limit;

			$view.stop().scrollTo( $elements[pos], settings );
			active = pos;
			return false;
		};				
	});
};

})( jQuery );

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.