Test Foro de elhacker.net SMF 2.1

Programación => Desarrollo Web => Mensaje iniciado por: Drakaris en 10 Diciembre 2017, 17:53 PM

Título: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: Drakaris en 10 Diciembre 2017, 17:53 PM
Hola. ¿Hay alguna función en jQuery Mobile que reemplace attr()?, como por ejemplo vtrr();

Gracias de antemano
Título: Re: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: engel lex en 10 Diciembre 2017, 18:46 PM
teoricamente attr sigue siendo attr en mobile, puedes mostrar donde te falla?
Título: Re: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: Drakaris en 10 Diciembre 2017, 21:03 PM

<script>
 $(document).bind(function(){
   if (window.matchMedia("(max-width: 600px)").matches){
     $("#fondo").attr("style","background-image: url('imagenes/fondo_movil.jpg'); background-repeat:no-repeat; background-position: 0% 0%; background-attachment: fixed; background-size: 205% 205%;-webkit-background-size: 205% 205%; -moz-background-size:205% 205%; -o-background-size: 205% 205%; background-color:#F5ECCE;");
     $("#address1").attr("style","bottom:5vmin; position:absolute; left:10%; font-size:9vw;")
     //Cambiar el footer
     $("#footer1").attr("style","width:202vw; height:230vh;");
     //Cambiar el header
     $("#header1").attr("style","width:130vw;");
     $("#icons").attr("style","float:left;")
     $(".light_sky").vclick(function(){
       $.ajax({
         type:'POST',
         url:'functions.php',
         data:'func=getEvents&date='+date,
         success:function(html){
           $('#event_list').html(html);
           $('#event_list').slideDown('slow');
         }
       });
     });
   }
 });
</script>

Este, es el código pero no se porque no me lo ejecuta

El script de jquery Mobile que implanté es el siguiente:
<script type="text/javascript" src="http://u1.linnk.it/qc8sbw/usr/apps/textsync/upload/jquery-mobile-touch.value.js"></script>
¿Es por el script?
Título: Re: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: [u]nsigned en 11 Diciembre 2017, 15:09 PM
Estas imlementando mal tu codigo. Deberias escuchar el evento ready de jquery, algo asi:

Código (javascript) [Seleccionar]
$(document).ready(function(){
   /*... aca tu codigo ..*/
})
Título: Re: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: Drakaris en 14 Diciembre 2017, 22:04 PM
[quote author=nsigned link=topic=477978.msg2148615#msg2148615 date=1513001378]
Estas imlementando mal tu codigo. Deberias escuchar el evento ready de jquery, algo asi:

Código (javascript) [Seleccionar]
$(document).ready(function(){
  /*... aca tu codigo ..*/
})

[/quote]

Hola, gracias por su atención pero me he informado que jQuery no se ejecuta en dispositivos móviles y era con jQuery Mobile cosa que se necesita poner $(document).bind() y no $(document).ready(), pero poniendo bind() no me ejecuta attr() cosa rara, porque teoricamente me tendría que ejecutar.

Yo creo que el error está en attr(), pero creo que no, y estoy pidiendo de vuestra ayuda, algunas conclusiones.

Gracias, por su atención.

Atentamente Drakaris.
Título: Re: ¿Hay alguna función en jQuery Mobile que reemplace attr()?
Publicado por: Drakaris en 16 Diciembre 2017, 16:33 PM
Al final lo he solucionado, lo he separado.