Forum FAQForum FAQSearchSearch MemberlistMemberlist Forum ignore listForum ignore list RegisterRegister ProfileProfile Log in to check your private messagesLog in to check your private messages Log inLog in
Javascript i pop-up

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side
View previous topic :: View next topic  
Author Message
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 23.08.2006 17:18    Post subject: Javascript i pop-up Add user to your forum ignore list Reply with quote

Ovako, ne znam JavuScript, ali moram nesto s njom napraviti...
Imam slicicu na koju kad se klikne treba se otvorit pop-up prozor sa velikom slikom...
To sam napravio, ali ne znam kako da napravim da se na klik velike slike zatvara pop-up prozor...
Imam ovaj kod pa ga vi prepravite za namjenu koju treba:

Code:
<a href="kuca_istok.jpg" onclick="window.open(this.href, 'Zgrada', 'width=820,height=720'); return false;"><img src="kuca_istok_mala.jpg" width="150" height="131" border="0"></a>


Hvala unaprijed

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
gog



Joined: 18 Jun 2004
Posts: 679
Location: zagreb

PostPosted: 23.08.2006 18:40    Post subject: Add user to your forum ignore list Reply with quote

Kôd za to moraš staviti u popup, a ne tamo gdje otvaraš popup.

Pogledaj JS funkciju window.close()
Back to top
View user's profile Send private message Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 23.08.2006 18:57    Post subject: Re: Javascript i pop-up Add user to your forum ignore list Reply with quote

Da rađe koristiš lightbox?

Stavi ovo u HEAD dokumenta:
Code:
<link rel="stylesheet" href="http://www.huddletogether.com/projects/lightbox2/css/lightbox.css" type="text/css" media="screen" />

<script src="http://www.huddletogether.com/projects/lightbox2/js/prototype.js" type="text/javascript"></script>
<script src="http://www.huddletogether.com/projects/lightbox2/js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="http://www.huddletogether.com/projects/lightbox2/js/lightbox.js" type="text/javascript"></script>


Makni popup code i ostavi samo ovo:
Code:
<a href="kuca_istok.jpg" rel="lightbox"><img src="kuca_istok_mala.jpg" width="150" height="131" border="0"></a>


Ako ti radi i ako ti se sviđa rezultat, najbolje prekopiraj lightbox skripte i CSS na svoj server prije nego što site uđe u produkciju
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vedran



Joined: 08 Sep 2003
Posts: 458

PostPosted: 23.08.2006 19:45    Post subject: Add user to your forum ignore list Reply with quote

Evo ovaj primjer otvara pop-up i na klik zatvara Smile

Js Funkcija:
Code:
function slika(imageURL) {
   var imgWin = window.open('about:blank','imgWin','width=200, height=200, left=100, top=100');

   with (imgWin.document) {
      writeln('<html><head><title>Loading...</title>');
      writeln('<style type="text/css">body { margin: 0px; padding: 0px } </style></head>');
      writeln('<body onload="self.focus();"><img alt="Klikni da zatvoriš pop-up prozor" style="cursor: pointer" onClick="window.close()" window.close() id="pic" /></body></html>');
      close();      
      }
   var img = new Image();
        img.onload = function() { sizeImgWin(imgWin, img) };
   img.src = imageURL;
}
   
function sizeImgWin(win, img) {
      var new_w = img.width;
   var new_h = img.height;
   var old_w = win.innerWidth || win.document.body.offsetWidth;
   var old_h = win.innerHeight || win.document.body.offsetHeight;
   if (!new_w) { new_w = old_w; }
   if (!new_h) { new_h = old_h; }
   new_w -= old_w; new_h -= old_h;
   win.resizeBy(new_w,new_h);
   win.document.title = "Pregled slike";
   var pic = win.document.getElementById('pic');
   pic.src = img.src;
   pic.style.display = 'block';
}


Primjer korištenja:
Code:
<a onclick="slika(this.href); return false;" href="slika_velika.jpg"><img border="0" src="slika_mala.jpg"></a>
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 23.08.2006 21:40    Post subject: Add user to your forum ignore list Reply with quote

popupovi su s****
lightbox rula
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vedran



Joined: 08 Sep 2003
Posts: 458

PostPosted: 23.08.2006 23:04    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
popupovi su s****
lightbox rula


Šminker! Evil or Very Mad
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Gale



Joined: 04 Apr 2005
Posts: 120

PostPosted: 23.08.2006 23:20    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
popupovi su s****
lightbox rula


Meni je osobno Thickbox bolji, a i onako preferiram jQuery nad Prototypom
Back to top
View user's profile Send private message Visit poster's website
unLog!c



Joined: 27 May 2004
Posts: 185
Location: Osijek

PostPosted: 24.08.2006 00:08    Post subject: Add user to your forum ignore list Reply with quote

meni je lightbox fora, al je jadno to što nema resize prevelikih slika na size ekrana i onda na click da se vrati na original Smile

A one obične pop-upove nevolim, previše su jadni i zastarjeli... rješenje kao lightbox je presuper Smile

_________________
Why dont you go out and play hide and go fuck your self like all other NORMAL kids?
Back to top
View user's profile Send private message MSN Messenger
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 24.08.2006 00:21    Post subject: Add user to your forum ignore list Reply with quote

Hvala Sulien za lightbox, bas je super....

Skinut cu si na server jer je zakon totalno...

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
gog



Joined: 18 Jun 2004
Posts: 679
Location: zagreb

PostPosted: 24.08.2006 15:03    Post subject: Add user to your forum ignore list Reply with quote

unLog!c wrote:
meni je lightbox fora, al je jadno to što nema resize prevelikih slika na size ekrana i onda na click da se vrati na original Smile


Ima ima, samo ne znam doduše ima li to "originalni" LB..
Back to top
View user's profile Send private message Visit poster's website
Sulien



Joined: 04 Jan 2004
Posts: 2905
Location: Zagreb

PostPosted: 24.08.2006 15:43    Post subject: Add user to your forum ignore list Reply with quote

Resize u browseru (bez resamplinga) toliko ne valja da se jednostavno ne isplati
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 24.08.2006 16:43    Post subject: Add user to your forum ignore list Reply with quote

Sulien wrote:
Resize u browseru (bez resamplinga) toliko ne valja da se jednostavno ne isplati


Reci ti njima..
Lightbox rula

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
killa



Joined: 12 Sep 2003
Posts: 277
Location: zagreb

PostPosted: 25.08.2006 10:41    Post subject: Add user to your forum ignore list Reply with quote

Lightbox je fakat ZAKON Wink

xexexe

_________________
[killa bee]
Back to top
View user's profile Send private message Visit poster's website
Tristan



Joined: 01 Aug 2006
Posts: 614
Location: Under the sky

PostPosted: 25.08.2006 11:10    Post subject: Add user to your forum ignore list Reply with quote

a ne ne... Samo ga malo prilagodis siteu svom i sve super...
Ni ne kuzi se ak stavis da pise zatvori i te stvari...

_________________
Carpe diem...
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    mi3dot.org Forum Index -> Client-side All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group