Trieste is the usual Italian getaway city from which people reach coastal Slovenia. From the bus station opposite the train station there are at least 2 buses a day in each direction. Tickets are about 900 sit.
Trieste to Portoroz
11.00 - 12.29
17.00 - 18.18
Portoroz to Trieste
13.31 - 15.00
19.01 - 20.30
I reached Portoroz from Koper, driven by a friend, in his car.
Portoroz can be made a base or a day excursion from Italy (Trieste) & Croatia (Istrian Peninsula).
Nearby towns like Piran, Strunjan & Koper are within easy reach. Buses are every 20 minutes on weekdays & every 40 minutes on weekends.
Morning bus to Zagreb in Croatia is at 5.55 am.
Many ways actually, here's some examples :
By train :
Koper: 15 km
Triest: 35 km
By road :
Munich - Triest - Koper - Portorož: 510 km
Vienna - Graz - Ljubljana - Portorož: 550 km
Venice - Triest - Koper - Portorož: 200 km
Vlak is Slovenian for train.
Get the timetable for Slovenian train service from the link I've given here.