PSD-Tutorials.de
Forum für Design, Fotografie & Bildbearbeitung
Tutkit
Agentur
Hilfe
Kontakt
Start
Forum
Aktuelles
Besonderer Inhalt
Foren durchsuchen
Tutorials
News
Anmelden
Kostenlos registrieren
Aktuelles
Suche
Suche
Nur Titel durchsuchen
Von:
Menü
Anmelden
Kostenlos registrieren
App installieren
Installieren
JavaScript ist deaktiviert. Für eine bessere Darstellung aktiviere bitte JavaScript in deinem Browser, bevor du fortfährst.
Du verwendest einen veralteten Browser. Es ist möglich, dass diese oder andere Websites nicht korrekt angezeigt werden.
Du solltest ein Upgrade durchführen oder einen
alternativen Browser
verwenden.
Antworten auf deine Fragen:
Neues Thema erstellen
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Background eine Klasse zuweisen
Beitrag
<blockquote data-quote="Triggertrix" data-source="post: 2029186" data-attributes="member: 306764"><p><strong>AW: Background eine Klasse zuweisen</strong></p><p></p><p>Ah…… jetzt verstehe ich das Missverständnis, Du siehst nur das was das JS am Ende rausschmeisst……</p><p></p><p>Moment mal</p><p></p><p>Also hier HTML (Original):</p><p>[CODE]<body></p><p> <div id="container"></p><p> <div id="head"></div></p><p> <div id="ps_overlay" class="ps_overlay" style="display:none;"></div></p><p> <a id="ps_close" class="ps_close" style="display:none;"></a></p><p> <div id="ps_container" class="ps_container" style="display:none;"></p><p> <a id="ps_next_photo" class="ps_next_photo" style="display:none;"></a></div></p><p> <div id="alle"></p><p> <div class="kasten"></p><p> <div class="album"></p><p> <h3 class="unterschrift">Ma Belle</h3> </p><p> <div class="back"><img src="galerie1/01.jpg"/> </div></p><p> <p class="beschreibung">Lorem ipsum ad qui amet dolore, vitae cetero quaerendum mel ea. Facilis fastidii duo no. Viris partiendo ius no, alia animal nam at. Feugait imperdiet ius an, no quis facer lucilius vis. Aliquam saperet contentiones ex pro.</p></p><p> <img src="galerie1/02.jpg"/></p><p> <img src="galerie1/03.jpg"/></p><p> <img src="galerie1/04.jpg"/></p><p> <img src="galerie1/05.jpg"/></p><p> <img src="galerie1/06.jpg"/></p><p> <img src="galerie1/07.jpg"/></p><p> <img src="galerie1/08.jpg"/></p><p> <img src="galerie1/09.jpg"/></p><p> <img src="galerie1/10.jpg"/></p><p> <img src="galerie1/11.jpg"/></p><p> <img src="galerie1/12.jpg"/></p><p> <img src="galerie1/13.jpg"/></p><p> </div></p><p> </div>[/CODE] usw. usf.</p><p></p><p>Hier das JS dass das dann zum Effekt macht (und die Bilder auf Hide setzt)</p><p>[CODE] <script type="text/javascript" language="javascript" charset="utf-8"></p><p> $(document).ready(function () {</p><p> $ps_albums = $("#alle");</p><p> $ps_albums.children(".kasten").find('img:not(:first)').hide();</p><p></p><p> var $ps_container = $('#ps_container');</p><p> var $ps_overlay = $('#ps_overlay');</p><p> var $ps_close = $('#ps_close');</p><p> $(".album").bind('click', function () {</p><p> var $albumb = $(this);</p><p></p><p> $ps_container.find('img').remove();</p><p> $(this).children('img').each(function () {</p><p> $img = $(this).*****();</p><p> var src = $img.attr('src');</p><p> resizeCenterImage($img);</p><p> $ps_container.append($img);</p><p> var r = Math.floor(Math.random() * 41) - 20;</p><p> $img.css({</p><p> '-moz-transform': 'rotate(' + r + 'deg)',</p><p> '-webkit-transform': 'rotate(' + r + 'deg)',</p><p> 'transform': 'rotate(' + r + 'deg)'</p><p> });</p><p> $img.show();</p><p> });</p><p> $ps_container.find('img').last().css({</p><p> '-moz-transform': 'rotate(0deg)',</p><p> '-webkit-transform': 'rotate(0deg)',</p><p> 'transform': 'rotate(0deg)'</p><p> });</p><p> $ps_container.show();</p><p> $ps_close.show();</p><p> $ps_overlay.show();</p><p> });</p><p> $ps_container.live('mouseenter', function () {</p><p> $('#ps_next_photo').show();</p><p> }).live('mouseleave', function () {</p><p> $('#ps_next_photo').hide();</p><p> });</p><p> $('#ps_next_photo').bind('click', function () {</p><p> var $current = $ps_container.find('img:last');</p><p> var r = Math.floor(Math.random() * 41) - 20;</p><p></p><p> var currentPositions = {</p><p> marginLeft: $current.css('margin-left'),</p><p> marginTop: $current.css('margin-top')</p><p> }</p><p> var $new_current = $current.prev();</p><p></p><p> $current.animate({</p><p> 'marginLeft': '250px',</p><p> 'marginTop': '-385px'</p><p> }, 250, function () {</p><p> $(this).insertBefore($ps_container.find('img:first')).css({</p><p> '-moz-transform': 'rotate(' + r + 'deg)',</p><p> '-webkit-transform': 'rotate(' + r + 'deg)',</p><p> 'transform': 'rotate(' + r + 'deg)'</p><p> }).animate({</p><p> 'marginLeft': currentPositions.marginLeft,</p><p> 'marginTop': currentPositions.marginTop</p><p> }, 250, function () {</p><p> $new_current.css({</p><p> '-moz-transform': 'rotate(0deg)',</p><p> '-webkit-transform': 'rotate(0deg)',</p><p> 'transform': 'rotate(0deg)'</p><p> });</p><p> });</p><p> });</p><p> });</p><p> $('#ps_close').bind('click', function () {</p><p> $ps_container.hide();</p><p> $ps_close.hide();</p><p> $ps_overlay.fadeOut(400);</p><p> });</p><p> });</p><p></p><p> function resizeCenterImage($image) {</p><p> var theImage = new Image();</p><p> theImage.src = $image.attr("src");</p><p> var imgwidth = theImage.width;</p><p> var imgheight = theImage.height;</p><p> var containerwidth = 700;</p><p> var containerheight = 510;</p><p></p><p> if (imgwidth > containerwidth) {</p><p> var newwidth = containerwidth;</p><p> var ratio = imgwidth / containerwidth;</p><p> var newheight = imgheight / ratio;</p><p> if (newheight > containerheight) {</p><p> var newnewheight = containerheight;</p><p> var newratio = newheight / containerheight;</p><p> var newnewwidth = newwidth / newratio;</p><p> theImage.width = newnewwidth;</p><p> theImage.height = newnewheight;</p><p> } else {</p><p> theImage.width = newwidth;</p><p> theImage.height = newheight;</p><p> }</p><p> } else if (imgheight > containerheight) {</p><p> var newheight = containerheight;</p><p> var ratio = imgheight / containerheight;</p><p> var newwidth = imgwidth / ratio;</p><p> if (newwidth > containerwidth) {</p><p> var newnewwidth = containerwidth;</p><p> var newratio = newwidth / containerwidth;</p><p> var newnewheight = newheight / newratio;</p><p> theImage.height = newnewheight;</p><p> theImage.width = newnewwidth;</p><p> } else {</p><p> theImage.width = newwidth;</p><p> theImage.height = newheight;</p><p> }</p><p> }</p><p> $image.css({</p><p> 'width': theImage.width,</p><p> 'height': theImage.height,</p><p> 'margin-top': -(theImage.height / 2) - 10 + 'px',</p><p> 'margin-left': -(theImage.width / 2) - 10 + 'px'</p><p> });</p><p> }</p><p> </p><p> </script>[/CODE]</p><p></p><p>Der Punkt ist wir gesagt, sobald ich die anderen Bilder raus nehme, habe ich kein Fotoalbum mehr, sprich der Effekt oder besser JS kann nix mehr greifen und daraus machen, das hiesse, irgendjemand (so würde ich es mir wünschen) könnte mir sagen was ich wo ändern muss (sofern das so einfach geht) das ich die Bilder aus dem HTML rausnehmen kann, echte Thumbnails reinsetzen und die original Bilder vom JS aus einem Ordner wo die dann alle (wieder in Unterordnern Galery1-2-3- usw.) drinnen liegen.</p><p></p><p>Und zu: </p><p>glaube ich bestimmt, ist aber für einen Noob wie mich einfach nur eine Überforderung, da alles was man anfasst wirre Dinge macht und es sich eher nach Massaker in Babylon als elegantes und einfaches Funktionen auslösen anfühlt.</p><p>Aber vielleicht verstehe ich auch dieses Mysterium eines Tages etwas und finde einen Zugangspunkt mich auch damit ein wenig auseinander setzten zu können. Interessant und funktional ist es definitiv.</p><p></p><p>Dank & Gruss</p></blockquote><p></p>
[QUOTE="Triggertrix, post: 2029186, member: 306764"] [b]AW: Background eine Klasse zuweisen[/b] Ah…… jetzt verstehe ich das Missverständnis, Du siehst nur das was das JS am Ende rausschmeisst…… Moment mal Also hier HTML (Original): [CODE]<body> <div id="container"> <div id="head"></div> <div id="ps_overlay" class="ps_overlay" style="display:none;"></div> <a id="ps_close" class="ps_close" style="display:none;"></a> <div id="ps_container" class="ps_container" style="display:none;"> <a id="ps_next_photo" class="ps_next_photo" style="display:none;"></a></div> <div id="alle"> <div class="kasten"> <div class="album"> <h3 class="unterschrift">Ma Belle</h3> <div class="back"><img src="galerie1/01.jpg"/> </div> <p class="beschreibung">Lorem ipsum ad qui amet dolore, vitae cetero quaerendum mel ea. Facilis fastidii duo no. Viris partiendo ius no, alia animal nam at. Feugait imperdiet ius an, no quis facer lucilius vis. Aliquam saperet contentiones ex pro.</p> <img src="galerie1/02.jpg"/> <img src="galerie1/03.jpg"/> <img src="galerie1/04.jpg"/> <img src="galerie1/05.jpg"/> <img src="galerie1/06.jpg"/> <img src="galerie1/07.jpg"/> <img src="galerie1/08.jpg"/> <img src="galerie1/09.jpg"/> <img src="galerie1/10.jpg"/> <img src="galerie1/11.jpg"/> <img src="galerie1/12.jpg"/> <img src="galerie1/13.jpg"/> </div> </div>[/CODE] usw. usf. Hier das JS dass das dann zum Effekt macht (und die Bilder auf Hide setzt) [CODE] <script type="text/javascript" language="javascript" charset="utf-8"> $(document).ready(function () { $ps_albums = $("#alle"); $ps_albums.children(".kasten").find('img:not(:first)').hide(); var $ps_container = $('#ps_container'); var $ps_overlay = $('#ps_overlay'); var $ps_close = $('#ps_close'); $(".album").bind('click', function () { var $albumb = $(this); $ps_container.find('img').remove(); $(this).children('img').each(function () { $img = $(this).*****(); var src = $img.attr('src'); resizeCenterImage($img); $ps_container.append($img); var r = Math.floor(Math.random() * 41) - 20; $img.css({ '-moz-transform': 'rotate(' + r + 'deg)', '-webkit-transform': 'rotate(' + r + 'deg)', 'transform': 'rotate(' + r + 'deg)' }); $img.show(); }); $ps_container.find('img').last().css({ '-moz-transform': 'rotate(0deg)', '-webkit-transform': 'rotate(0deg)', 'transform': 'rotate(0deg)' }); $ps_container.show(); $ps_close.show(); $ps_overlay.show(); }); $ps_container.live('mouseenter', function () { $('#ps_next_photo').show(); }).live('mouseleave', function () { $('#ps_next_photo').hide(); }); $('#ps_next_photo').bind('click', function () { var $current = $ps_container.find('img:last'); var r = Math.floor(Math.random() * 41) - 20; var currentPositions = { marginLeft: $current.css('margin-left'), marginTop: $current.css('margin-top') } var $new_current = $current.prev(); $current.animate({ 'marginLeft': '250px', 'marginTop': '-385px' }, 250, function () { $(this).insertBefore($ps_container.find('img:first')).css({ '-moz-transform': 'rotate(' + r + 'deg)', '-webkit-transform': 'rotate(' + r + 'deg)', 'transform': 'rotate(' + r + 'deg)' }).animate({ 'marginLeft': currentPositions.marginLeft, 'marginTop': currentPositions.marginTop }, 250, function () { $new_current.css({ '-moz-transform': 'rotate(0deg)', '-webkit-transform': 'rotate(0deg)', 'transform': 'rotate(0deg)' }); }); }); }); $('#ps_close').bind('click', function () { $ps_container.hide(); $ps_close.hide(); $ps_overlay.fadeOut(400); }); }); function resizeCenterImage($image) { var theImage = new Image(); theImage.src = $image.attr("src"); var imgwidth = theImage.width; var imgheight = theImage.height; var containerwidth = 700; var containerheight = 510; if (imgwidth > containerwidth) { var newwidth = containerwidth; var ratio = imgwidth / containerwidth; var newheight = imgheight / ratio; if (newheight > containerheight) { var newnewheight = containerheight; var newratio = newheight / containerheight; var newnewwidth = newwidth / newratio; theImage.width = newnewwidth; theImage.height = newnewheight; } else { theImage.width = newwidth; theImage.height = newheight; } } else if (imgheight > containerheight) { var newheight = containerheight; var ratio = imgheight / containerheight; var newwidth = imgwidth / ratio; if (newwidth > containerwidth) { var newnewwidth = containerwidth; var newratio = newwidth / containerwidth; var newnewheight = newheight / newratio; theImage.height = newnewheight; theImage.width = newnewwidth; } else { theImage.width = newwidth; theImage.height = newheight; } } $image.css({ 'width': theImage.width, 'height': theImage.height, 'margin-top': -(theImage.height / 2) - 10 + 'px', 'margin-left': -(theImage.width / 2) - 10 + 'px' }); } </script>[/CODE] Der Punkt ist wir gesagt, sobald ich die anderen Bilder raus nehme, habe ich kein Fotoalbum mehr, sprich der Effekt oder besser JS kann nix mehr greifen und daraus machen, das hiesse, irgendjemand (so würde ich es mir wünschen) könnte mir sagen was ich wo ändern muss (sofern das so einfach geht) das ich die Bilder aus dem HTML rausnehmen kann, echte Thumbnails reinsetzen und die original Bilder vom JS aus einem Ordner wo die dann alle (wieder in Unterordnern Galery1-2-3- usw.) drinnen liegen. Und zu: glaube ich bestimmt, ist aber für einen Noob wie mich einfach nur eine Überforderung, da alles was man anfasst wirre Dinge macht und es sich eher nach Massaker in Babylon als elegantes und einfaches Funktionen auslösen anfühlt. Aber vielleicht verstehe ich auch dieses Mysterium eines Tages etwas und finde einen Zugangspunkt mich auch damit ein wenig auseinander setzten zu können. Interessant und funktional ist es definitiv. Dank & Gruss [/QUOTE]
Bilder bitte
hier hochladen
und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Zitate einfügen…
Authentifizierung
Wenn ▲ = 7, ▼ = 3, ◇ = 2 und die Summe von ▲ und ▼ durch ◇ geteilt wird, was ist das Ergebnis?
Antworten
Start
Forum
Sonstiges
Webdesign, Webentwicklung & Programmierung
Webdesign: HTML/CSS, Responsive Design, Sass...
Background eine Klasse zuweisen
Oben