Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> jquery szerokość / wysokość obrazka różne style
marcus755
post
Post #1





Grupa: Zarejestrowani
Postów: 158
Pomógł: 1
Dołączył: 6.12.2012

Ostrzeżenie: (0%)
-----


Jeśli szerokość obrazka większa niż wysokość, to jakiś styl,
jeśli wysokość obrazka większa niż szeokość, to jakiś inny styl,
jak zrobić?
co z poniższym kodem jest nie tak, że nie działa?
jak go zapisać prościej?

  1.  
  2. $(document).ready(function(){
  3.  
  4. var theHeight = $(".image img").height() > $(".image img").width();
  5. var theWidth = $(".image img").height() < $(".image img").width();
  6. alert(theHeight);
  7.  
  8. if ($(".image img") == theHeight) {
  9. $(this).css({"border":"0px #000 solid"});
  10. }
  11. if ($(".image img") == theWidth) {
  12. $(this).css({"border":"3px #000 solid"});
  13. }
  14. });
  15.  


Ten post edytował marcus755 9.09.2014, 10:52:00
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.09.2025 - 04:34